]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Do not allow a comma at the end of a JSON array or object.
authordrh <drh@noemail.net>
Wed, 23 Sep 2015 01:10:29 +0000 (01:10 +0000)
committerdrh <drh@noemail.net>
Wed, 23 Sep 2015 01:10:29 +0000 (01:10 +0000)
FossilOrigin-Name: 7c7a3f3e9bc2f7a7334d8d6eae183d83f22097be

ext/misc/json1.c
manifest
manifest.uuid
test/json101.test

index db8d09b9bcb74b25736f4fcc00f0f348a9a73bc3..3dd831f9c572989c5adda6de54671a9066be6870 100644 (file)
@@ -606,7 +606,7 @@ static int jsonParseValue(JsonParse *pParse, u32 i){
       while( safe_isspace(pParse->zJson[j]) ){ j++; }
       x = jsonParseValue(pParse, j);
       if( x<0 ){
-        if( x==(-2) ) return j+1;
+        if( x==(-2) && pParse->nNode==(u32)iThis+1 ) return j+1;
         return -1;
       }
       if( pParse->oom ) return -1;
@@ -636,7 +636,7 @@ static int jsonParseValue(JsonParse *pParse, u32 i){
       while( safe_isspace(pParse->zJson[j]) ){ j++; }
       x = jsonParseValue(pParse, j);
       if( x<0 ){
-        if( x==(-3) ) return j+1;
+        if( x==(-3) && pParse->nNode==(u32)iThis+1 ) return j+1;
         return -1;
       }
       j = x;
index 43c8af7630659b610706795d8633e9712c83693b..d85cf93eacc871a25f3edd838f52bfc7c70eb7f9 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sthe\s--export-sql\sand\s--export-db\soptions\sto\sthe\sfuzzcheck\sutility\sprogram.
-D 2015-09-22T18:51:17.054
+C Do\snot\sallow\sa\scomma\sat\sthe\send\sof\sa\sJSON\sarray\sor\sobject.
+D 2015-09-23T01:10:29.723
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 2047811644c5bac91ccdfc2720e49b60965a63a7
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -195,7 +195,7 @@ F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2
 F ext/misc/fileio.c d4171c815d6543a9edef8308aab2951413cd8d0f
 F ext/misc/fuzzer.c 4c84635c71c26cfa7c2e5848cf49fe2d2cfcd767
 F ext/misc/ieee754.c b0362167289170627659e84173f5d2e8fee8566e
-F ext/misc/json1.c 8eefcbdc172e9eff3c613016260c2d82893c12f2
+F ext/misc/json1.c 7659013d8d84a263ae60cd01cdc25d3596cf5063
 F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342
 F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63
 F ext/misc/regexp.c af92cdaa5058fcec1451e49becc7ba44dba023dc
@@ -815,7 +815,7 @@ F test/journal3.test ff8af941f9e06161d3db1b46bb9f965ff0e7f307
 F test/jrnlmode.test 7864d59cf7f6e552b9b99ba0f38acd167edc10fa
 F test/jrnlmode2.test 81610545a4e6ed239ea8fa661891893385e23a1d
 F test/jrnlmode3.test 556b447a05be0e0963f4311e95ab1632b11c9eaa
-F test/json101.test bfc81e4bdb412a1659160a4284448bd212ba6df1
+F test/json101.test 07f0d847d943bf5ad6e8fb60699a7f4c57317321
 F test/json102.test 796b1c59894c6e0f38fc1a3acb0e690573b952a3
 F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff
 F test/lastinsert.test 42e948fd6442f07d60acbd15d33fb86473e0ef63
@@ -1387,7 +1387,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P b6ae61fe3b3de3aa296b3e56cd2ec425a5141c73
-R 67147fe50bd6bcd304574882b2915749
+P 760af4455115669b934c3115d45cffe89c085faf
+R 6b381fff3f89ce025323ce04ac2d6070
 U drh
-Z f2fe8ea148ad21aa4f5e236ec8c81968
+Z 8b081193fe15e32207901b3f263d0f6d
index 36534fefd4cf30d4c78fbfb8f35f13de64ee72e8..5101911d89a0db7f693981c026fc91239ccb88cf 100644 (file)
@@ -1 +1 @@
-760af4455115669b934c3115d45cffe89c085faf
\ No newline at end of file
+7c7a3f3e9bc2f7a7334d8d6eae183d83f22097be
\ No newline at end of file
index 4f1b7056d9e9e4b3645b55e9563e2f0e9f18b6d3..22bbb4d5e43709039748cf43c9e9beaa139a68f8 100644 (file)
@@ -305,6 +305,18 @@ do_execsql_test json-5.8 {
    WHERE jx.value<>jx.atom AND type NOT IN ('array','object');
 } {}
 
+do_execsql_test json-6.1 {
+  SELECT json_valid('{"a":55,"b":72,}');
+} {0}
+do_execsql_test json-6.2 {
+  SELECT json_valid('{"a":55,"b":72}');
+} {1}
+do_execsql_test json-6.3 {
+  SELECT json_valid('["a",55,"b",72,]');
+} {0}
+do_execsql_test json-6.4 {
+  SELECT json_valid('["a",55,"b",72]');
+} {1}
 
 
 finish_test