mirror of
https://github.com/php/php-src.git
synced 2025-08-16 22:18:50 +02:00
Merge branch 'PHP-7.0' into PHP-7.1
This commit is contained in:
commit
37c12f8f86
2 changed files with 25 additions and 0 deletions
|
@ -258,6 +258,16 @@ static PHP_FUNCTION(json_decode)
|
||||||
RETURN_NULL();
|
RETURN_NULL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (depth <= 0) {
|
||||||
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Depth must be greater than zero");
|
||||||
|
RETURN_NULL();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (depth > INT_MAX) {
|
||||||
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Depth must be lower than %d", INT_MAX);
|
||||||
|
RETURN_NULL();
|
||||||
|
}
|
||||||
|
|
||||||
/* For BC reasons, the bool $assoc overrides the long $options bit for PHP_JSON_OBJECT_AS_ARRAY */
|
/* For BC reasons, the bool $assoc overrides the long $options bit for PHP_JSON_OBJECT_AS_ARRAY */
|
||||||
if (assoc) {
|
if (assoc) {
|
||||||
options |= PHP_JSON_OBJECT_AS_ARRAY;
|
options |= PHP_JSON_OBJECT_AS_ARRAY;
|
||||||
|
|
15
ext/json/tests/bug72787.phpt
Normal file
15
ext/json/tests/bug72787.phpt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #72787 (json_decode reads out of bounds)
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if (!extension_loaded("json")) print "skip"; ?>
|
||||||
|
<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
var_dump(json_decode('[]', false, 0x100000000));
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
|
||||||
|
Warning: json_decode(): Depth must be lower than %d in %s on line %d
|
||||||
|
NULL
|
Loading…
Add table
Add a link
Reference in a new issue