Christoph M. Becker
09171dc1d7
Fix #79877 : getimagesize function silently truncates after a null byte
...
We have to check for NUL bytes if `getimagesize()` has been called.
(cherry picked from commit ff577b04c0 )
2020-08-03 11:04:57 +02:00
Andy Postnikov
2c57378bd3
Fix bug #78008 : dns_check_record() always return true on Alpine
...
- free handle before return result
- cleaned up remaining usage of MAXPACKET
- update dns_get_mx() to use the same approach
Closes GH-5854.
2020-07-15 15:10:19 +02:00
Evgeny Stepanischev
ce149b0cb8
Fixed bug #79849
...
Closes GH-5853.
2020-07-14 12:41:43 +02:00
twosee
f0b2c2cb98
Fixed BC break of php_debug_zval_dump
...
It introduced by fixing bug #79830
2020-07-11 18:30:28 +08:00
twosee
56dec3cc73
Fixed bug #79830 introduced by fixing bug #79821
...
This also fixes memory error in debug_zval_dump and var_export.
2020-07-11 14:37:25 +08:00
twosee
150504e6b1
Fixed bug #79821
...
HashTable was reallocated (zend_hash_packed_grow) during php_var_dump, so we should call GC_ADDREF to make SEPARATE_ARRAY work.
Closes GH-5837.
2020-07-11 06:14:22 +08:00
Nikita Popov
a72c53a070
Fixed bug #79817
...
Use *_IND macros in a few places in string.c.
2020-07-10 14:06:41 +02:00
Christoph M. Becker
7f3bc64287
Fix #70362 : Can't copy() large 'data://' with open_basedir
...
open_basedir is only relevant for plain files, so there is no need to
check it for other URL wrappers.
2020-06-30 10:46:53 +02:00
Christoph M. Becker
12c59f6660
Fix #74267 : segfault with streams and invalid data
...
If the current character is a line break character, it cannot be a tab
or space character, so we would always fail with an invalid sequence
error. Obviously, these `scan_stat == 4` conditions are meant to be
exclusive.
Furthermore, if `in_pp == NULL || in_left_p == NULL` is true, we hit a
segfault if we are not returning right away. Obviously, the additional
constraints don't make sense, so we remove them.
2020-06-08 23:19:43 +02:00
Christoph M. Becker
c40a494406
Fix #79561 : dns_get_record() fails with DNS_ALL
...
Since Windows has its own definitions of the `PHP_DNS_*` macros, we
have to use these when registering the PHP constants.
2020-05-04 22:59:38 +02:00
Christoph M. Becker
d950969e59
Add basic sapi_windows_cp_conv() test
...
This function is lacking any tests so far.
2020-05-04 11:50:03 +02:00
Nikita Popov
b56fb9019e
Don't leak peername if accept fails
...
Even if the accept fails, the peername may be populated.
2020-04-14 16:07:39 +02:00
Christoph M. Becker
a1b46fc152
Fix test cases
2020-04-14 13:58:48 +02:00
dinosaur
95eaccd0bb
Fixed bug #79468
...
Close the stream filter resources when removing them from the stream.
2020-04-14 11:59:51 +02:00
Stanislav Malyshev
d539e61c30
Merge branch 'PHP-7.2' into PHP-7.3
...
* PHP-7.2:
Fix bug #79465 - use unsigneds as indexes.
Fix bug #79330 - make all execution modes consistent in rejecting \0
2020-04-13 21:09:08 -07:00
Stanislav Malyshev
9d6bf8221b
Fix bug #79465 - use unsigneds as indexes.
2020-04-13 21:08:37 -07:00
Stanislav Malyshev
14fcc81394
Fix bug #79330 - make all execution modes consistent in rejecting \0
2020-04-13 21:08:30 -07:00
Christian Schneider
c0840fec9c
Fix bug #79410 (system() swallows last chunk if it is exactly 4095 bytes without newline)
...
Closes GH-5292.
2020-03-25 10:50:35 +01:00
Stanislav Malyshev
69fdc14152
Fix bug #79329 - get_headers should not accept \0
2020-03-16 22:40:00 -07:00
Stanislav Malyshev
0d139c5b94
Fix bug #79329 - get_headers should not accept \0
2020-03-15 17:30:44 -07:00
Christoph M. Becker and Nikita Popov
53797c206a
Fix #78210 : Invalid pointer address
...
This is actually about three distinct issues:
* If an empty string is passed as $address to `stream_socket_sendto()`,
the `sa` is not initialized, so we must not pass it as `addr` to
`php_stream_xport_sendto()`.
* On POSIX, `recvfrom()` truncates messages which are too long to fit
into the specified buffer (unless `MSG_PEEK` is given), discards the
excessive bytes, and returns the buffer length. On Windows, the same
happens, but `recvfrom()` returns `SOCKET_ERROR` with the error code
`WSAEMSGSIZE`. We have to catch this for best POSIX compatibility.
* In `php_network_parse_network_address_with_port()`, we have to zero
`in6` (not only its alias `sa`) to properly support IPv6.
Co-Authored-By: Nikita Popov <nikita.ppv@googlemail.com >
2020-03-11 11:30:15 +01:00
Christoph M. Becker
d5e206620b
Enclose INI values containing {TMP} in quotes
...
At least on Windows, the temporary directory may contain tilde signs,
which would result in an INI parse error.
2020-03-09 22:49:08 +01:00
Nikita Popov
56cdbe63c2
Don't treat any WS as start of header
...
Check that the header occurs after \n, not other whitespace
characters.
2020-02-24 10:20:33 +01:00
Nikita Popov
3d9c02364d
Reduce code duplication in HTTP header checks
2020-02-24 10:03:05 +01:00
Miguel Xavier Penha Neto
d0d60503b5
Fixes #79265 : Improper injection of Host header when using fopen for http requests
...
Check all occurrences of the string "host:" (and other headers),
not just the first one.
2020-02-24 09:50:32 +01:00
Christoph M. Becker
ad000a63e8
Add test for bug #78569
2020-02-21 10:31:26 +01:00
Christoph M. Becker
7b464ce6f3
Fix #79254 : getenv() w/o arguments not showing changes
...
To be able to see changes done only with `SetEnvironmentVariable()`, we
have to use `GetEnvironmentStrings()` instead of `environ`, because the
latter sees only changes done with `putenv()`.
For best backward compatibility we're using `GetEnvironmentStringsA()`;
switching to the wide string version likely makes sense for master,
though.
2020-02-11 11:47:29 +01:00
Ivan Mikheykin
fd08f062ae
Fix bug #78323 : Code 0 is returned on invalid options
...
Set CLI exit code to 1 when invalid parameters are passed,
and print error to stderr.
2020-01-27 13:32:19 +01:00
Christoph M. Becker
372b678e56
Yet another check for php_strip_tags_ex()
2020-01-24 13:02:02 +01:00
liudaixiao
67421a780d
Fixed bug #78902
2020-01-23 14:57:16 +01:00
Léopold Jacquot
f720fb1e21
Add unit test for bug #78902
2020-01-23 14:53:28 +01:00
Stanislav Malyshev
dd3c664f8f
Merge branch 'PHP-7.2' into PHP-7.3
...
* PHP-7.2:
More checks for php_strip_tags_ex
2020-01-22 22:41:56 -08:00
Stanislav Malyshev
2dc170e25d
More checks for php_strip_tags_ex
2020-01-22 22:37:30 -08:00
Stanislav Malyshev
25ec7eb346
Merge branch 'PHP-7.2' into PHP-7.3
...
* PHP-7.2:
Update NEWS
Fix bug #79037 (global buffer-overflow in `mbfl_filt_conv_big5_wchar`)
Fix #79099 : OOB read in php_strip_tags_ex
Fix #79091 : heap use-after-free in session_create_id()
2020-01-20 22:46:29 -08:00
Stanislav Malyshev
0f79b1bf30
Fix #79099 : OOB read in php_strip_tags_ex
2020-01-20 21:43:42 -08:00
Christoph M. Becker
ae2150692a
Fix #54298 : Using empty additional_headers adding extraneous CRLF
...
If the header string is empty, we pass `NULL` to `php_mail()` to avoid
further checks on the string length.
2020-01-06 14:47:23 +01:00
Nikita Popov
0f078f6e78
Add destructor annotations in ini parser
...
It would be better to switch this to use %union and %type annotations,
but not going to do that change for 7.3.
2019-12-19 10:43:05 +01:00
Stanislav Malyshev
a65b8abf2c
Merge branch 'PHP-7.2' into PHP-7.3
...
* PHP-7.2:
Fixed bug #78910
Fix #78878 : Buffer underflow in bc_shift_addsub
Fix test
Fix #78862 : link() silently truncates after a null byte on Windows
Fix #78863 : DirectoryIterator class silently truncates after a null byte
2019-12-16 00:38:54 -08:00
Christoph M. Becker
0e6c0654ed
Fix #78862 : link() silently truncates after a null byte on Windows
...
Since link() is supposed to accepts paths (i.e. strings without NUL
bytes), we must not accept arbitrary strings.
2019-12-16 00:03:06 -08:00
Christoph M. Becker
861fa60814
Merge branch 'PHP-7.2' into PHP-7.3
...
* PHP-7.2:
Fix #78814 : strip_tags allows / in tag name => whitelist bypass
2019-12-02 11:38:45 +01:00
Christoph M. Becker
600f1f898f
Fix #78814 : strip_tags allows / in tag name => whitelist bypass
...
When normalizing tags to check whether they are contained in the set
of allowable tags, we must not strip slashes, unless they come
immediately after the opening `<`, or immediately before the closing
`>`.
2019-12-02 11:37:25 +01:00
Christoph M. Becker
bb735c9e9e
Fix #78296 : is_file fails to detect file
...
If we're constructing extended-length paths (i.e. paths prefixed with
`\\?\`), we have to replace all forward slashes with backward slashes,
because the former are not supported by Windows for extended-length
paths.
The more efficient and likely cleaner alternative solution would be to
cater to this in `php_win32_ioutil_normalize_path_w()` by always
replacing forward slashes, but that might break existing code. It
might be sensible to change that for `master`, though.
2019-12-02 11:29:10 +01:00
Christoph M. Becker
3d81c54879
Merge branch 'PHP-7.2' into PHP-7.3
...
* PHP-7.2:
Fix #78833 : Integer overflow in pack causes out-of-bound access
2019-12-02 11:19:15 +01:00
Christoph M. Becker
db420cb6a1
Fix #78833 : Integer overflow in pack causes out-of-bound access
...
We check for potential signed integer overflow, and bail out
gracefully, in that case.
2019-12-02 11:18:19 +01:00
Christoph M. Becker
fee38633d2
Fix #78840 : imploding $GLOBALS crashes
...
We add support for IS_INDIRECT zvals to implode().
2019-11-27 09:32:16 +01:00
Christoph M. Becker
23c65a8173
Fix #77638 : var_export'ing certain class instances segfaults
...
If objects return immutable property hash tables (typically,
`zend_empty_array`), we must not try to apply recursion protection on
those.
2019-11-25 15:54:11 +01:00
Levi Morrison
4a55794b98
Wrap php_random.h in C++ portability macros
...
Also remove portability headers. This goes against the existing
conventions of these files.
2019-11-08 07:58:26 -07:00
Levi Morrison
b9dfa12853
Wrap hrtime in extern "c" {}
...
This allows it to be used by C++ extensions without them having to do their own forward declares.
Closes GH-4890.
2019-11-07 14:41:58 +01:00
Nikita Popov
29f4939923
Merge branch 'PHP-7.2' into PHP-7.3
...
* PHP-7.2:
Remove outdated comments in test
2019-11-07 14:06:33 +01:00
Nikita Popov
ee243bc471
Remove outdated comments in test
2019-11-07 14:06:23 +01:00