com php-src: Fix bug #68817: Null pointer deference: ext/json/JSON_parser.c ext/json/tests/bug68817 .phpt

From: Date: Thu, 15 Jan 2015 00:12:35 +0000
Subject: com php-src: Fix bug #68817: Null pointer deference: ext/json/JSON_parser.c ext/json/tests/bug68817 .phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-84096@lists.php.net to get a copy of this message
Commit: 7f95aa4d97b6a687f7b4565157b934610d354f43 Author: Stanislav Malyshev <stas@php.net> Wed, 14 Jan 2015 16:12:35 -0800 Parents: c7c62303fba833895466a28488d048266666dfe0 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7f95aa4d97b6a687f7b4565157b934610d354f43 Log: Fix bug #68817: Null pointer deference Bugs: https://bugs.php.net/68817 Changed paths: M ext/json/JSON_parser.c A ext/json/tests/bug68817.phpt Diff: diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c index 22508b7..4c17eb2 100644 --- a/ext/json/JSON_parser.c +++ b/ext/json/JSON_parser.c @@ -582,7 +582,7 @@ parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, json_create_zval(&mval, &buf, type, options); add_next_index_zval(&jp->the_zstack[jp->top], &mval); - buf.s->len = 0; + if (buf.s) { buf.s->len = 0; } JSON_RESET_TYPE(); } diff --git a/ext/json/tests/bug68817.phpt b/ext/json/tests/bug68817.phpt new file mode 100644 index 0000000..aa9a63f --- /dev/null +++ b/ext/json/tests/bug68817.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #68817 (Null pointer deference) +--SKIPIF-- +<?php if (!extension_loaded("json")) print "skip"; ?> +--FILE-- +<?php + +var_dump(json_decode('[""]')); + +?> +===DONE=== +--EXPECTF-- +array(1) { + [0]=> + string(0) "" +} +===DONE===

« previous php.cvs (#84096) next »