Commit Graph

6769 Commits

Author SHA1 Message Date
Nikita Popov
157ddd9577 Fix potential integer overflow in nl2br
The buffer size was calculated manually, thus creating integer overflows
for very large inputs, e.g. nl2br(str_repeat("\n", 613566757)).

The code now uses safe_emalloc, thus making the code throw an error
instead of crashing.
2012-07-05 20:41:54 +02:00
Nikita Popov
88f46b162b Fix potential integer overflow in bin2hex
The code was already using safe_emalloc but did the multiplication in
the first argument, thus making the use of safe_emalloc pretty useless.

The *2 is now moved to the second argument.
2012-07-05 20:14:49 +02:00
Nikita Popov
e6cf7d7745 Fix some lengths in crypt()
Use salt_len_in instead of strlen(salt) or PHP_MAX_SALT_LEN, otherwise too
much memory will be allocated.

sha512 has a 86 character checksum, not 43. That probably was a copy&paste
from the sha256 code which indeed has 43.

The allocation also was using sizeof(char *), thus allocating 4 or 8 times
as much memory as necessary. The sizeof(char *) was removed in the 5.4
branch in b7a92c9 but forgotten on 5.3.

The memset 0 call was using PHP_MAX_SALT_LEN which can be smaller than the
output buffer and thus not zeroing out everything. Use the size of the
output buffer (needed) instead.
2012-06-29 13:11:43 +02:00
Anthony Ferrara
7e8276ca68 Fixed bug #62443 (Crypt SHA256/512 Segfaults With Malformed Salt)
Fixed a memory allocation bug in crypt() SHA256/512 that can
cause segmentation faults when passed in salts with a null byte
early.
2012-06-28 20:00:03 -04:00
Moriyoshi Koizumi
e427182279 Fix bug #62373 (serialize() generates wrong reference to the object) 2012-06-25 19:13:23 +09:00
Nikita Popov
5b3f4d25ea Fix memory allocation checks for base64 encode
base64_encode used safe_emalloc, but one of the arguments was derived from a
multiplication, thus making the allocation unsafe again.

There was a size check in place, but it was off by a factor of two as it
didn't account for the signedness of the integer type.

The unsafe allocation is not exploitable, but still causes funny behavior
when the sized overflows into a negative number.

To fix the issue the *4 factor is moved into the size argument (where it is
known to be safe), so safe_emalloc can carry out the multiplication.

The size check is removed as it doesn't really make sense once safe_emalloc
works correctly. (Would only cause base64_encode to silently return false
instead of throwing an error. Also could cause problems with other uses of
the base64 encoding API, which all don't check for a NULL return value.)

Furthermore the (length + 2) < 0 check is replaced with just length < 0.
Allowing lengths -2 and -1 doesn't make sense semantically and also is not
honored in the following code (negative length would access unallocated
memory.)

Actually the length < 0 check doesn't make sense altogether, but I left it
there just to be safe.
2012-06-24 23:32:50 +02:00
Johannes Schlüter
a62d4e2c43 Remove extra ; 2012-06-22 17:32:46 +02:00
Pierrick Charron
fed5923dbc Fixed bug #51094 (parse_ini_file() with INI_SCANNER_RAW cuts a value that includes a semi-colon)
Modify the scanner to check if the first char of the raw data is an opening " in which case we
need to find the closing one. Otherwise just search for the next end of value char [\r\n;\000]
2012-06-07 17:44:20 +02:00
Jille Timmermans
a331f43f8c Typofix in comment in proc_open.c 2012-05-30 14:42:39 +08:00
Stanislav Malyshev
aab49e934d fix CVE-2012-2143 2012-05-29 23:07:04 -07:00
Matt Ficken
4aac4da673 Fixed bug #62148 mail_skipif doesn't skip imap tests on Release Build 2012-05-25 10:34:33 +02:00
Matt Ficken
d4d36fba28 Fixed bug #62147 test bug - popen_pclose_basic-win32 2012-05-25 09:53:51 +02:00
Stanislav Malyshev
6e51989501 fd fix 2012-05-16 16:35:16 +02:00
Nuno Lopes
950d5ee590 fix stack overflow in php_intlog10abs()
bug uncovered by LLVM/clang's new -fbounds-checking switch
this patch fixes a crash in ext/standard/tests/math/round_large_exp.phpt
2012-05-11 13:07:00 -04:00
Anatoliy Belsky
266578f584 Fix bug #61992 ext\standard\tests\general_functions\bug44295.phpt fails
Exception text differ on windows
2012-05-10 17:07:38 +02:00
Anatoliy Belsky
f7d8b274c7 Fix bug ext\standard\tests\file\realpath_cache_win32.phpt fails
What happens here is trivial long overflow. Despite the bug attracted
attention on windows, the same story is on linux. Just wait for a big
anough bucket->key . The linux test had %i to check the key value
which should be %d all the way.
2012-05-10 15:27:44 +02:00
Matt Ficken
c12fdbde5f Fix bug 61746 Failing tests in ext/standard/tests/file/windows_links/*
Fixed that again for systems having their %SYSTEMROOT% not in
c:\windows
2012-05-08 19:31:41 +02:00
Anatoliy Belsky
d776a933eb Fix bug 61713 check also that mbstring's found any internal_encoding 2012-05-08 18:31:11 +02:00
Anatoliy Belsky
3a4a25358f Fix bug #61713 ext\standard\tests\strings\htmlentities10.phpt fails
There is a logic error in charset detection part for htmlentities.
When mbstring is compiled shared and mbstring.internal_encoding
is set to pass, it prevents default_charset from being checked
resulting iso-8859-1 being choosed.
2012-05-08 17:42:01 +02:00
Xinchen Hui
99076bc24f Change the test folder 2012-05-06 20:31:40 +08:00
Xinchen Hui
7ccd594392 Fixed bug #61730 (Segfault from array_walk modifying an array passed by reference) 2012-05-06 20:01:10 +08:00
Reeze Xia
3e9923dd8d Fixed Bug #61961 (file_get_content leaks when access empty file with max length) 2012-05-06 18:27:26 +08:00
Christopher Jones
c864b1ca2f Fix masking in bug61115-1.phpt
The test bug61115-1.phpt was diffing for non-debug builds
2012-05-01 14:32:09 -07:00
Anatoliy Belsky
ec5421d044 Additional fixs for bug 61746 - prepare/clean acls 2012-04-30 14:33:48 +02:00
Xinchen Hui
a601605f14 merge test from PHP-5.4 2012-04-30 12:33:55 +08:00
Xinchen Hui
d80a3d9668 Revert "Merge branch 'fix-pro_nice-test' of https://github.com/reeze/php-src into PHP-5.3"
After pushed, I found the test script in 5.4 is already fixed this, so
revert this change, and be consistent with 5.4's test

This reverts commit 24d85e4bd8, reversing
changes made to bae56a87f8.
2012-04-30 12:31:33 +08:00
Xinchen Hui
24d85e4bd8 Merge branch 'fix-pro_nice-test' of https://github.com/reeze/php-src into PHP-5.3 2012-04-30 12:29:15 +08:00
Felipe Pena
d44a383986 - Added missing bound check in iptcparse() (path by chris at chiappa.net) 2012-04-29 19:12:12 -03:00
reeze
e52be10b30 Fix test for proc_nice: bsd ps command didn't support option -o "%p %n" 2012-04-30 00:59:54 +08:00
Anatoliy Belsky
4e9db5ba9f Fix bug #61800 ext\standard\tests\streams\bug61371.phpt fails 2012-04-26 13:27:01 +02:00
Anatoliy Belsky
433290e199 Partial fix for bug 61743 to get correct icacls path 2012-04-25 18:38:27 +02:00
Gustavo André dos Santos Lopes
8d748e5de5 Fixed bug #61764: 'I' unpacks n as signed if n > 2^31-1 on LP64
Also fixed possible invalid read on big endian LP64.
2012-04-23 22:09:38 +01:00
Xinchen Hui
2e9eb5e32f Fix test
Reported by cjones
2012-04-21 16:02:25 +08:00
Anatoliy Belsky
f3d86b314f Fix bug 61746 Failing tests in ext/standard/tests/file/windows_links/* 2012-04-16 17:06:30 +02:00
Anatoliy Belsky
9a4cb732ed Fix bug 61743 tests in ext\standard\tests\file\windows_acls\* fail 2012-04-16 13:30:58 +02:00
Xinchen Hui
8c4294bcb4 Fixed test faild
the sun_path will not be that much long:
 http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/un.h.html
2012-04-13 00:07:07 +08:00
Anatoliy Belsky
ed0ddd20c5 Fixed bug #61669 ext\standard\tests\file\rename_variation7-win32.phpt fails 2012-04-10 15:16:48 +02:00
Anatoliy Belsky
b0cb29db87 Fixed bug #61668 ext\standard\tests\file\rename_variation13-win32.phpt fails 2012-04-10 15:09:21 +02:00
Anatoliy Belsky
b9cbb9e744 Fix bug #61667 ext\standard\tests\file\glob_variation-win32.phpt fails 2012-04-10 15:00:03 +02:00
Anatoliy Belsky
fde96342e8 Fixed bug #61666 ext\standard\tests\file\file_put_contents_variation8-win32.phpt fails 2012-04-10 14:13:15 +02:00
Anatoliy Belsky
d80e2e069c Fixed bug 61621 Test fail in ext/standard/tests/dir 2012-04-10 12:47:01 +02:00
Gustavo André dos Santos Lopes
0f180a63eb Fixed bug in new stream_get_line() when using NUL as a delimiter.
This is the issue Derick spotted a few days ago..
2012-04-07 16:32:19 +01:00
Gustavo André dos Santos Lopes
ca58cd01fc Cherry-pick 4cc74767
Headers: forbid \r and \n also after \0, allow CRLF followed by HT or SP and forbid \0. See bug #60227.

Conflicts:

	ext/standard/tests/general_functions/bug60227.phpt
	ext/standard/tests/general_functions/bug60227_1.phpt
	ext/standard/tests/general_functions/bug60227_2.phpt
	main/SAPI.c
2012-04-04 09:59:51 +01:00
Xinchen Hui
7b04638c8c Fix test
cherry-pick from php-5.4
2012-04-04 15:20:28 +08:00
Matt Ficken
438536e45e Fix bug #61460 popen_close_error-win32 expected output is wrong 2012-04-03 14:19:43 +02:00
Anatoliy Belsky
14e74aeb57 Fix bug #61454 ext\standard\tests\general_functions\bug49847.phpt fails 2012-04-03 13:23:06 +02:00
Anatoliy Belsky
469cd3abf1 Fix bug #61517 random test failure - ext/standard/tests/misc/time_sleep_until_basic.phpt 2012-04-03 11:04:52 +02:00
Shein Alexey
c0f806a69c Merge branch 'fix-debug-build-bug61115-1.phpt' into PHP-5.3
* fix-debug-build-bug61115-1.phpt:
  Fixed bug61115-1.phpt for debug build version.
2012-03-29 17:01:40 +05:00
Shein Alexey
e1352b0416 Fixed bug61115-1.phpt for debug build version. 2012-03-29 16:51:45 +05:00
Johannes Schlüter
21fa9634c1 Merge remote branch 'security/PHP-5.3' into PHP-5.3
* security/PHP-5.3:
  fix bug #61367 - open_basedir bypass using libxml RSHUTDOWN
  open_basedir check for linkinfo
  NEWS entry for readline fix
  Add open_basedir checks to readline_write_history and readline_read_history
2012-03-29 10:54:08 +02:00