Commit Graph

130 Commits

Author SHA1 Message Date
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
George Peter Banyard
c40231afbf
Mark various functions with void arguments.
This fixes a bunch of [-Wstrict-prototypes] warning,
because in C func() and func(void) have different semantics.
2021-05-12 14:55:53 +01:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
Nikita Popov
3e01f5afb1 Replace zend_bool uses with bool
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +01:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Nikita Popov
7643cf1996 More precise ifunc resolver return type
Fixes -Wattribute-alias warning.
2020-04-15 11:01:12 +02:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
George Peter Banyard
5b8e12a99b Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove dead code in base64.c
2019-08-20 21:46:51 +02:00
George Peter Banyard
01996c4b69 Remove dead code in base64.c 2019-08-20 21:42:06 +02:00
Dmitry Stogov
11a4e2787f Merge branch 'PHP-7.4'
* PHP-7.4:
  neon vectorization for base64
2019-07-11 12:04:51 +03:00
Sebastian Pop
3b73c9fb86 neon vectorization for base64
A similar algorithm is used to vectorize on x86_64, with a good description in
https://arxiv.org/abs/1704.00605 . On AArch64 the implementation differs in that
instead of using multiplies to shift bits around, it uses the vld3+vst4 and
vld4+vst3 combinations to load and store interleaved data.  This patch is based
on the NEON implementation of Wojciech Mula:
https://github.com/WojciechMula/base64simd/blob/master/encode/encode.neon.cpp
https://github.com/WojciechMula/base64simd/blob/master/encode/lookup.neon.cpp
and
https://github.com/WojciechMula/base64simd/blob/master/encode/encode.neon.cpp
https://github.com/WojciechMula/base64simd/blob/master/encode/encode.neon.cpp
adapted to php/ext/standard/base64.c and vectorized with factor 16 instead of 8.

On a Graviton A1 instance and on the synthetic benchmarks in
https://github.com/lemire/fastbase64 I see 175% speedup on base64 encoding and
60% speedup on base64 decode compared to the scalar implementation.

The patch passes `make test` regression testing on aarch64-linux.
2019-07-11 12:04:29 +03:00
Nikita Popov
8f0729cb65 Merge branch 'PHP-7.4' 2019-06-28 17:47:45 +02:00
Nikita Popov
88d52ae7aa Mark ifunc resolver functions as unused
It looks like clang doesn't see that these are used through
__attribute__((ifunc)) and generates a warning.
2019-06-28 16:55:54 +02:00
Nikita Popov
a1a8d14485 Update more func info information for ext/standard 2019-05-29 15:30:06 +02:00
Nikita Popov
96daef0458 Make ABI of SIMD optimized functions independent of compiler flags
Always export these as normal functions and only use function pointers
internally if necessary.
2019-02-14 11:49:21 +01:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Zeev Suraski
0cf7de1c70 Remove yearly range from copyright notice 2019-01-30 11:03:12 +02:00
Nikita Popov
1bc86bcdd8 Merge branch 'PHP-7.3' 2019-01-18 15:03:00 +01:00
Nikita Popov
986b9b5ae3 Add additional no_sanitize_address attributes
To fix bug #77447 in release mode as well.
2019-01-18 15:02:30 +01:00
bugreportuser
59d99a2c47 Remove unnecessary base64_encode() return value check
php_base64_encode() never returns NULL, so base64_encode() will never return
false.
2018-09-23 14:49:10 +02:00
Peter Kokot
a5e80b22e1 Fix typos in code comments 2018-07-25 11:57:11 +02:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Dmitry Stogov
524f5245c5 Avoid useless checks, using zend_string_efree(), in cases where the string is known to be a temporary allocated zend_string. 2018-05-08 17:30:15 +03:00
Xinchen Hui
c29f1f41c3 Combines common codes 2018-03-02 10:32:15 +08:00
Xinchen Hui
966923f4be Attempt to fix build again
seems if a cpu supports avx2 but not ssse3, the build will fail. but how
could that possible... :<
2018-03-01 15:05:50 +08:00
Xinchen Hui
fd208e82dd Attempt to fix build reported fails in containers 2018-03-01 11:56:12 +08:00
Anatol Belski
1bdf7abbcb Fix possible int overflow on vars used in loop with size_t counter 2018-02-18 17:55:50 +01:00
Xinchen Hui
6de9c91ba6 Update author info 2018-02-12 21:01:12 +08:00
Xinchen Hui
cf0fae5e97 Optimized base64_encode/decode with SIMD instructions 2018-02-12 20:53:14 +08:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Sara Golemon
3de82a0349
Provide zend_string wrappers for php_base64_(en|de)code
Also pull existing php_base64_decode() proxy out to an inline.
Bump PHP_API_VERSION for ABI change.
2017-07-16 17:01:20 -04:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Sara Golemon
54c13295a6 Use new param API in standard 2016-12-30 09:12:17 -08:00
Xinchen Hui
ce6ad9bdd9 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: (48 commits)
  Update NEWs
  Unused label
  Fixed bug #72853 (stream_set_blocking doesn't work)
  fix test
  Bug #72663 - part 3
  Bug #72663 - part 2
  Bug #72663 - part 1
  Update NEWS
  BLock test with memory leak
  fix tests
  Fix TSRM build
  Fix bug #72850 - integer overflow in uuencode
  Fixed bug #72849 - integer overflow in urlencode
  Fix bug #72848 - integer overflow in quoted_printable_encode caused heap corruption
  Fix bug #72838 - 	Integer overflow lead to heap corruption in sql_regcase
  Fix bug #72837 - integer overflow in bzdecompress caused heap corruption
  Fix bug #72836 - integer overflow in base64_decode caused heap corruption
  Fix for bug #72807 - do not produce strings with negative length
  Fix for bug #72790 and bug #72799
  Fix bug #72730 - imagegammacorrect allows arbitrary write access
  ...

Conflicts:
	ext/standard/var_unserializer.c
2016-08-17 17:14:30 +08:00
Stanislav Malyshev
0d13325b66 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6: (24 commits)
  Update NEWS
  BLock test with memory leak
  fix tests
  Fix TSRM build
  Fix bug #72850 - integer overflow in uuencode
  Fixed bug #72849 - integer overflow in urlencode
  Fix bug #72848 - integer overflow in quoted_printable_encode caused heap corruption
  Fix bug #72838 - 	Integer overflow lead to heap corruption in sql_regcase
  Fix bug #72837 - integer overflow in bzdecompress caused heap corruption
  Fix bug #72836 - integer overflow in base64_decode caused heap corruption
  Fix for bug #72807 - do not produce strings with negative length
  Fix for bug #72790 and bug #72799
  Fix bug #72730 - imagegammacorrect allows arbitrary write access
  Fix bug#72697 - select_colors write out-of-bounds
  Fixed bug #72627: Memory Leakage In exif_process_IFD_in_TIFF
  Fix bug #72750: wddx_deserialize null dereference
  Fix bug #72771: ftps:// opendir wrapper is vulnerable to protocol downgrade attack
  Improve fix for #72663
  Fix bug #70436: Use After Free Vulnerability in unserialize()
  Fix bug #72749: wddx_deserialize allows illegal memory access
  ...

Conflicts:
	Zend/zend_API.h
	ext/bz2/bz2.c
	ext/curl/interface.c
	ext/ereg/ereg.c
	ext/exif/exif.c
	ext/gd/gd.c
	ext/gd/tests/imagetruecolortopalette_error3.phpt
	ext/gd/tests/imagetruecolortopalette_error4.phpt
	ext/session/session.c
	ext/snmp/snmp.c
	ext/standard/base64.c
	ext/standard/ftp_fopen_wrapper.c
	ext/standard/quot_print.c
	ext/standard/url.c
	ext/standard/uuencode.c
	ext/standard/var.c
	ext/standard/var_unserializer.c
	ext/standard/var_unserializer.re
	ext/wddx/tests/bug72790.phpt
	ext/wddx/tests/bug72799.phpt
	ext/wddx/wddx.c
	sapi/cli/generate_mime_type_map.php
2016-08-17 00:43:33 -07:00
Stanislav Malyshev
40bd921cea Fix TSRM build 2016-08-16 22:55:43 -07:00
Stanislav Malyshev
d6a43a8562 Fix bug #72836 - integer overflow in base64_decode caused heap corruption 2016-08-16 22:55:41 -07:00
Nikita Popov
bb51da29dc Make base64_decode() in non-strict mode binary safe 2016-07-22 18:20:34 +02:00
Lauri Kenttä
316d5a19a6 base64_decode: Handle all invalid padding equally 2016-07-22 18:03:56 +02:00
Lauri Kenttä
5c62f3f68e base64_decode: strict: Fail on excessive padding 2016-07-22 18:03:56 +02:00
Lauri Kenttä
586a0761ff base64_decode: strict: Fail on truncated input 2016-07-22 18:03:56 +02:00
Lauri Kenttä
0981e5de3c base64_decode: Avoid code duplication in failures 2016-07-22 18:03:55 +02:00
Lauri Kenttä
3104759915 base64_decode: fix bug #72264 ('VV= =' shouldn't fail in strict mode) 2016-07-07 01:27:23 +02:00
Lauri Kenttä
0259459486 base64_decode: remove redundant code
case 1 is already handled in the first lines of the for loop;
it would only be entered in the invalid case where the string
continues past the defined length (ch != 0 but length-- == 0).

case 2 and case 3 are redundant, since k >= j and later the
string is truncated to j characters anyway.
2016-07-07 01:27:23 +02:00
Lauri Kenttä
c1ac081bf1 base64_decode: fix bug #72263 (skips char after padding) 2016-07-07 01:27:23 +02:00
Lauri Kenttä
b9c9be13cc base64_decode: fix bug #72152 (fail on NUL bytes in strict mode)
This added check is actually for NOT failing in NON-strict mode.
The ch == -2 check later causes the desired failure in strict mode.
2016-07-07 01:27:23 +02:00
Lauri Kenttä
ef6f163161 base64_decode: remove redundant check
If length == 0 || *current != '=' is false, the for loop will always
end up in this same point, until the if statement becomes true.
Thus, the if statement is not needed.
2016-07-07 01:27:23 +02:00
Lauri Kenttä
c65de8ac13 base64_decode: reorder to fix out of bounds read 2016-07-07 01:27:22 +02:00
Lauri Kenttä
3380acbdd4 base64_decode: fix bug #72264 ('VV= =' shouldn't fail in strict mode) 2016-07-05 16:51:36 +02:00
Lauri Kenttä
77e8c299ba base64_decode: remove redundant code
case 1 is already handled in the first lines of the for loop;
it would only be entered in the invalid case where the string
continues past the defined length (ch != 0 but length-- == 0).

case 2 and case 3 are redundant, since k >= j and later the
string is truncated to j characters anyway.
2016-07-05 16:51:36 +02:00