cvs: php-src /ext/json json.c
| From: | Jani Taskinen | Date: | Tue, 22 Jul 2008 17:06:00 +0000 |
| Subject: | cvs: php-src /ext/json json.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-51386@lists.php.net to get a copy of this message | ||
jani Tue Jul 22 17:06:00 2008 UTC
Modified files:
/php-src/ext/json json.c
Log:
MFB:-Â Fixed bug #38680 (Added missing handling of basic types in json_decode)
# This was claimed to be in HEAD but wasn't..some commit reverted it or
# someone didn't check for real..
http://cvs.php.net/viewvc.cgi/php-src/ext/json/json.c?r1=1.37&r2=1.38&diff_format=u
Index: php-src/ext/json/json.c
diff -u php-src/ext/json/json.c:1.37 php-src/ext/json/json.c:1.38
--- php-src/ext/json/json.c:1.37 Tue Jul 22 15:30:33 2008
+++ php-src/ext/json/json.c Tue Jul 22 17:06:00 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: json.c,v 1.37 2008/07/22 15:30:33 jani Exp $ */
+/* $Id: json.c,v 1.38 2008/07/22 17:06:00 jani Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -545,6 +545,8 @@
}
if (str_len > 1 && *str.s == '"' && str.s[str_len-1] ==
'"') {
RETURN_STRINGL(str.s+1, str_len-2, 1);
+ } else if (*str.s == '{' || *str.s == '[') { /* invalid JSON string */
+ RETURN_NULL();
} else {
RETURN_STRINGL(str.s, str_len, 1);
}
@@ -576,6 +578,8 @@
}
if (str_len > 1 && *str.u == 0x22 /*'"'*/ && str.u[str_len-1]
== 0x22 /*'"'*/) {
RETURN_UNICODEL(str.u+1, str_len-2, 1);
+ } else if (*str.u == 0x7b /*'{'*/ || *str.u == 0x5b /*'['*/ ) { /* invalid
JSON string */
+ RETURN_NULL();
} else {
RETURN_UNICODEL(str.u, str_len, 1);
}