cvs: php-src(PHP_5_2) / NEWS /ext/json json.c /ext/json/tests bug42090.phpt

From: Date: Tue, 24 Jul 2007 22:57:14 +0000
Subject: cvs: php-src(PHP_5_2) / NEWS /ext/json json.c /ext/json/tests bug42090.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-45591@lists.php.net to get a copy of this message
bjori Tue Jul 24 22:57:14 2007 UTC Added files: (Branch: PHP_5_2) /php-src/ext/json/tests bug42090.phpt Modified files: /php-src/ext/json json.c /php-src NEWS Log: MFH: Fixed bug#42090 (json_decode causes segmentation fault) http://cvs.php.net/viewvc.cgi/php-src/ext/json/json.c?r1=1.9.2.18&r2=1.9.2.19&diff_format=u Index: php-src/ext/json/json.c diff -u php-src/ext/json/json.c:1.9.2.18 php-src/ext/json/json.c:1.9.2.19 --- php-src/ext/json/json.c:1.9.2.18 Mon Jul 23 12:24:52 2007 +++ php-src/ext/json/json.c Tue Jul 24 22:57:13 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: json.c,v 1.9.2.18 2007/07/23 12:24:52 tony2001 Exp $ */ +/* $Id: json.c,v 1.9.2.19 2007/07/24 22:57:13 bjori Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -470,7 +470,7 @@ RETURN_DOUBLE(d); } } - if (*parameter == '"' && parameter[parameter_len-1] == '"') { + if (parameter_len > 1 && *parameter == '"' && parameter[parameter_len-1] == '"') { RETURN_STRINGL(parameter+1, parameter_len-2, 1); } else if (*parameter == '{' || *parameter == '[') { /* invalid JSON string */ RETURN_NULL(); http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.856&r2=1.2027.2.547.2.857&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.856 php-src/NEWS:1.2027.2.547.2.857 --- php-src/NEWS:1.2027.2.547.2.856 Tue Jul 24 22:35:18 2007 +++ php-src/NEWS Tue Jul 24 22:57:13 2007 @@ -64,6 +64,7 @@ - Fixed PECL bug #11216 (crash in ZipArchive::addEmptyDir when a directory already exists). (Pierre) +- Fixed bug #42090 (json_decode causes segmentation fault). (Hannes) - Fixed bug #42072 (No warning message for clearstatcache() with arguments). (Ilia) - Fixed bug #42071 (ini scanner allows using NULL as option name). (Jani) http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/bug42090.phpt?view=markup&rev=1.1 Index: php-src/ext/json/tests/bug42090.phpt +++ php-src/ext/json/tests/bug42090.phpt --TEST-- Bug#42090 (json_decode causes segmentation fault) --SKIPIF-- <?php if (!extension_loaded("json")) print "skip"; ?> --FILE-- <?php var_dump( json_decode('""'), json_decode('"..".'), json_decode('"'), json_decode('""""'), json_encode('"'), json_decode(json_encode('"')), json_decode(json_encode('""')) ); ?> --EXPECT-- string(0) "" string(5) "".."." string(1) """ string(2) """" string(4) ""\""" string(1) """ string(2) """" --UEXPECT-- unicode(0) "" unicode(5) "".."." unicode(1) """ unicode(2) """" string(4) ""\""" unicode(1) """ unicode(2) """"

« previous php.cvs (#45591) next »