Commit Graph

28653 Commits

Author SHA1 Message Date
Nikita Popov
d86b6ea35c Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  Fix some lengths in crypt()

Conflicts:
	ext/standard/crypt.c
2012-06-29 13:15:35 +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
34ab5650bc Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  Fixed bug #62443 (Crypt SHA256/512 Segfaults With Malformed Salt)
2012-06-28 20:36:21 -04: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
Nikita Popov
405ebfcd18 Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  Add json_last_error_msg() function
2012-06-28 20:18:19 +02:00
Nikita Popov
974324676b Add json_last_error_msg() function
This replaces json_last_error(true) and is consistent with other custom
error handling functions.
2012-06-28 20:11:27 +02:00
Johannes Schlüter
b025b9d0cf Fix #62432 ReflectionMethod random corrupt memory on high concurrent
This fixes the same issue in multiple extensions. This isn't needed
in later branches as 5.4 introduced object_properties_init()
2012-06-27 23:26:33 +02:00
Nikita Popov
d372b33c9b Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  Improve JSON error handling

Conflicts:
	ext/json/tests/bug54058.phpt
	ext/json/tests/bug61537.phpt
2012-06-27 12:28:55 +02:00
Nikita Popov
4662151ea7 Improve JSON error handling
json_encode() no longer throws warnings. Instead only the error code for
json_last_error() is set.

As it is hard to debug the error from just an error code an optional
$as_string parameter was added to json_last_error(), which returns an
error message instead of an error code.
2012-06-27 12:21:48 +02:00
Moriyoshi Koizumi
91e1df704e Fix bug #62373 (serialize() generates wrong reference to the object) 2012-06-25 19:14:19 +09:00
Moriyoshi Koizumi
e427182279 Fix bug #62373 (serialize() generates wrong reference to the object) 2012-06-25 19:13:23 +09:00
Nikita Popov
ad641950b3 Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  Fix memory allocation checks for base64 encode
2012-06-24 23:56:55 +02: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
Nikita Popov
36fa17a5fa Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  Improve json_encode error handling
  - BFN

Conflicts:
	ext/json/json.c
2012-06-23 21:14:45 +02:00
Nikita Popov
84fe2cc890 Improve json_encode error handling
json_encode() now returns bool(false) for all possible errors, throws the
respective warning and also sets the respective json_last_error() error
code. Three new error codes have been added:

  * JSON_ERROR_RECURSION
  * JSON_ERROR_INF_OR_NAN
  * JSON_ERROR_UNSUPPORTED_TYPE

To get a partial JSON output instead of bool(false) the option
JSON_PARTIAL_OUTPUT_ON_ERROR can be specified. In this case the invalid
segments will be replaced either by null (for recursion, unsupported type
and invalid JSON) or 0 (for Inf and NaN).

The warning for invalid UTF-8 stays intact and is thrown also with
display_errors = On. If this behavior is undesired this can be remedied
later.
2012-06-23 20:51:52 +02:00
Felipe Pena
5e36306feb Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  - Improved fix for #62384
2012-06-23 15:16:13 -03:00
Felipe Pena
c3f34796a0 - Improved fix for #62384 2012-06-23 15:10:47 -03:00
Johannes Schlüter
5e23a047ac Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  Remove extra ;
2012-06-22 17:33:22 +02:00
Johannes Schlüter
a62d4e2c43 Remove extra ; 2012-06-22 17:32:46 +02:00
Felipe Pena
4af92aca87 Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  - Fixed bug #62384 (Attempting to invoke a Closure more than once causes segfaul)
2012-06-22 12:05:55 -03:00
Felipe Pena
b8e946b02e - Fixed bug #62384 (Attempting to invoke a Closure more than once causes segfaul) 2012-06-22 12:05:29 -03:00
Johannes Schlüter
af516750ff Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  Improve check for :memory: pseudo-filename in SQlite

Conflicts:
	ext/sqlite3/sqlite3.c
2012-06-22 12:50:30 +02:00
Johannes Schlüter
055ecbc628 Improve check for :memory: pseudo-filename in SQlite 2012-06-22 12:48:39 +02:00
Johannes Schlüter
041dd77135 Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  Remove outdated and user-specific files
2012-06-20 19:47:44 +02:00
Johannes Schlüter
d93892de7a Remove outdated and user-specific files 2012-06-20 19:46:32 +02:00
Nikita Popov
fed1f2d124 Fixed bug RecursiveArrayIterator does not implement Countable
ArrayIterator implemented Countable only after it was already inherited by
RecursiveArrayIterator. Thus the interface was missing in RAI.
2012-06-19 18:32:44 +02:00
Nikita Popov
cce4764f13 Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  Fixed bug RecursiveArrayIterator does not implement Countable

Conflicts:
	ext/spl/spl_array.c
2012-06-19 18:08:22 +02:00
Nikita Popov
4cba4c6193 Fixed bug RecursiveArrayIterator does not implement Countable
ArrayIterator implemented Countable only after it was already inherited by
RecursiveArrayIterator. Thus the interface was missing in RAI.
2012-06-19 18:04:14 +02:00
Anatoliy Belsky
34bd1c941b Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  sync zip ext version with pecl
2012-06-19 17:17:11 +02:00
Anatoliy Belsky
e793539678 sync zip ext version with pecl 2012-06-19 17:15:56 +02:00
Anatoliy Belsky
0a65b661e4 Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  split gzgetc_basic.phpt for zlib 1.2.7
2012-06-19 14:12:54 +02:00
Anatoliy Belsky
a8948d0808 split gzgetc_basic.phpt for zlib 1.2.7 2012-06-19 14:08:34 +02:00
Anatoliy Belsky
c56ff2bf75 Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  Reverted the BC fix regarding to #57905, test adopted
2012-06-17 16:10:56 +02:00
Anatoliy Belsky
d3780f1f90 Reverted the BC fix regarding to #57905, test adopted
New 0.10.1 has a stronger archive integrity check. Restoring
the old behaviour of libzip < 0.10.1 makes no sense at this
place.
2012-06-17 16:04:36 +02:00
Anatoliy Belsky
280e3a4ec8 Fixed bug #62312 ext\sockets\tests\socket_import_stream-4.phpt fails 2012-06-14 18:02:53 +02:00
Anatoliy Belsky
3faebe2bec Fix bug #62270 Test bug - ext/fileinfo/tests/finfo_open_error-win32 2012-06-14 17:59:39 +02:00
Stanislav Malyshev
c7be96b08f Revert "Add PBKDF2 support via openssl()"
This reverts commit b5b8ea1050.
Looks like we don't have agreement yet on this for 5.4. Let's keep it in 5.5 for now.
2012-06-12 11:22:49 -07:00
Stanislav Malyshev
a2bfad051d Revert "Rename openssl_pkcs5_pbkdf2_hmac() to something that doesn't sound like a spell."
This reverts commit bccd1e672f.
Looks like we don't have agreement yet on this for 5.4. Let's keep it in 5.5 for now.
2012-06-12 11:21:54 -07:00
Scott MacVicar
bccd1e672f Rename openssl_pkcs5_pbkdf2_hmac() to something that doesn't sound like a spell.
Summary:
Stas pointed out that this is named pretty poorly. Go for openssl_pbkdf2()
2012-06-11 15:41:41 -07:00
Scott MacVicar
b5b8ea1050 Add PBKDF2 support via openssl()
Summary:
No easy way to put these in the hash extension since we don't really support optional
parameters to certain algorithms. Implemented in openssl for now since it has it already
and is pretty stable.

Only SHA1 is confirmed to work as an algorithm but openssl has a parameter so it can be
changed in the future.

Will backport to 5.4 potentially with Stas' approval.

Test Plan:
Ran newly added tests which came from RFC 6070
2012-06-11 13:35:25 -07:00
Matt Ficken
a18cede1c5 Fix bug #62271 test bug - ext/wddx/tests/bug48562.phpt 2012-06-11 17:00:36 +02:00
David Soria Parra
b9babd22e0 Merge branch 'PHP-5.3' into PHP-5.4
By Stanislav Malyshev (1) and michelangelo (1)
* PHP-5.3:
  Adding a test for ext/posix/tests/posix_getegid_basic.phpt
  typo
2012-06-10 17:08:02 +04:00
michelangelo
cda14b995c Adding a test for ext/posix/tests/posix_getegid_basic.phpt 2012-06-10 17:07:49 +04:00
Gustavo André dos Santos Lopes
503358c179 Fix bug #62266
Custom extension segfaults during xmlParseFile with FPM SAPI
because the regular list is not prepared during the MINIT phase
and our custom external entity loader tries to open PHP streams.
2012-06-09 17:29:47 +01:00
Anatoliy Belsky
d24d5b62c1 Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  set current versions for libzip and zip ext
2012-06-07 22:37:32 +02:00
Anatoliy Belsky
baacc2cb13 set current versions for libzip and zip ext 2012-06-07 22:32:03 +02:00
Anatoliy Belsky
5ebdc46aa0 Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  zip windows fixes
  fixed bc break related to #57905
  fixed a bit overlooked from the last libzip port
  brought the fix for #47667 back
  fixed zip entry freeing
  rechecked the merged libzip, took also the indents from the original to avoid confusion next time
  fixed a double freeing crash
  fixed header include
  initial libzip upgrade patch to 0.10.1
  - BFN

Conflicts:
	NEWS
2012-06-07 21:06:31 +02:00
Anatoliy Belsky
bde0e8c2a1 zip windows fixes 2012-06-07 21:01:32 +02:00
Anatoliy Belsky
8ca457f64d fixed bc break related to #57905 2012-06-07 21:01:32 +02:00
Anatoliy Belsky
e883892664 fixed a bit overlooked from the last libzip port 2012-06-07 21:01:32 +02:00