diff options
author | Jakub Zelenka <bukka@php.net> | 2016-08-14 14:01:36 +0100 |
---|---|---|
committer | Jakub Zelenka <bukka@php.net> | 2016-08-14 14:01:36 +0100 |
commit | 37c12f8f867ad96e005cefc545093e43b633728c (patch) | |
tree | 445dea292a1831dcc148d64f2d13731affe33cd0 /ext/json/json.c | |
parent | 6ab9b531bc12ba3e746be6615f4edcc1cc387e61 (diff) | |
parent | 436d50a82192cbef4431fe9a70c641f49aec55a8 (diff) | |
download | php-git-37c12f8f867ad96e005cefc545093e43b633728c.tar.gz |
Merge branch 'PHP-7.0' into PHP-7.1
Diffstat (limited to 'ext/json/json.c')
-rw-r--r-- | ext/json/json.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/json/json.c b/ext/json/json.c index e8b111b28c..2acfb5e79f 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -258,6 +258,16 @@ static PHP_FUNCTION(json_decode) 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; |