com php-src: Merge branch 'PHP-5.6' into PHP-7.0: ext/json/json.c
| From: | Jakub Zelenka | Date: | Sun, 14 Aug 2016 13:00:35 +0000 |
| Subject: | com php-src: Merge branch 'PHP-5.6' into PHP-7.0: ext/json/json.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-93774@lists.php.net to get a copy of this message | ||
Commit: 436d50a82192cbef4431fe9a70c641f49aec55a8
Author: Jakub Zelenka <bukka@php.net> Sun, 14 Aug 2016 14:00:35 +0100
Parents: 98787d90020c7b21c1dd5d1701e6157993d02aec 9f1d962ed6057a3996f1b5aa82467a3172e41e8f
Branches: PHP-7.0
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=436d50a82192cbef4431fe9a70c641f49aec55a8
Log:
Merge branch 'PHP-5.6' into PHP-7.0
Changed paths:
MM ext/json/json.c
Diff:
diff --cc ext/json/json.c
index 6571bf9,8c4d20f..61445ee
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@@ -253,13 -838,12 +253,23 @@@ static PHP_FUNCTION(json_decode
return;
}
- JSON_G(error_code) = 0;
+ JSON_G(error_code) = PHP_JSON_ERROR_NONE;
if (!str_len) {
+ JSON_G(error_code) = PHP_JSON_ERROR_SYNTAX;
+ 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
*/
if (assoc) {
options |= PHP_JSON_OBJECT_AS_ARRAY;