Replace some unreachable branches from the JSON1 extension with assert().

FossilOrigin-Name: 145cd13e3c5a42a717807bcc13c0f7212f38bff8
This commit is contained in:
drh 2016-11-07 15:15:42 +00:00
parent ad875e7416
commit 27b2d1b88b
3 changed files with 13 additions and 12 deletions

View File

@ -595,12 +595,13 @@ static void jsonReturn(
c = z[++i]; c = z[++i];
if( c=='u' ){ if( c=='u' ){
u32 v = 0, k; u32 v = 0, k;
for(k=0; k<4 && i<n-2; i++, k++){ for(k=0; k<4; i++, k++){
assert( i<n-2 );
c = z[i+1]; c = z[i+1];
if( c>='0' && c<='9' ) v = v*16 + c - '0'; assert( safe_isxdigit(c) );
else if( c>='A' && c<='F' ) v = v*16 + c - 'A' + 10; if( c<='9' ) v = v*16 + c - '0';
else if( c>='a' && c<='f' ) v = v*16 + c - 'a' + 10; else if( c<='F' ) v = v*16 + c - 'A' + 10;
else break; else v = v*16 + c - 'a' + 10;
} }
if( v==0 ) break; if( v==0 ) break;
if( v<=0x7f ){ if( v<=0x7f ){

View File

@ -1,5 +1,5 @@
C Fix\sthe\sJSON1\sextension\sso\sthat\sthe\sJSON\svalidator\scorrectly\srejects\smalformed\nbackslash\sescapes\swithin\sstring\sliterals. C Replace\ssome\sunreachable\sbranches\sfrom\sthe\sJSON1\sextension\swith\sassert().
D 2016-11-07T13:37:28.861 D 2016-11-07T15:15:42.501
F Makefile.in 6fd48ffcf7c2deea7499062d1f3747f986c19678 F Makefile.in 6fd48ffcf7c2deea7499062d1f3747f986c19678
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc e0217f2d35a0448abbe4b066132ae20136e8b408 F Makefile.msc e0217f2d35a0448abbe4b066132ae20136e8b408
@ -213,7 +213,7 @@ F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2
F ext/misc/fileio.c d4171c815d6543a9edef8308aab2951413cd8d0f F ext/misc/fileio.c d4171c815d6543a9edef8308aab2951413cd8d0f
F ext/misc/fuzzer.c 7c64b8197bb77b7d64eff7cac7848870235d4c25 F ext/misc/fuzzer.c 7c64b8197bb77b7d64eff7cac7848870235d4c25
F ext/misc/ieee754.c f190d0cc5182529acb15babd177781be1ac1718c F ext/misc/ieee754.c f190d0cc5182529acb15babd177781be1ac1718c
F ext/misc/json1.c 813a2ff17b3e951a4b875ef79b5f4a0543cb0a2d F ext/misc/json1.c b8aa1219d25df9c135e067844f515cbaa452395d
F ext/misc/memvfs.c e5225bc22e79dde6b28380f3a068ddf600683a33 F ext/misc/memvfs.c e5225bc22e79dde6b28380f3a068ddf600683a33
F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342 F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342
F ext/misc/percentile.c 92699c8cd7d517ff610e6037e56506f8904dae2e F ext/misc/percentile.c 92699c8cd7d517ff610e6037e56506f8904dae2e
@ -1530,7 +1530,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P b86b79c442a58d10aa005ba4f34095375a88d242 P 7a63539169a384960e30a63e0c8e9b0f07fa431e
R 7a809bd65e85c52e8075f2c4e33138f7 R 301a8516f843000230cab1da4034b3ce
U drh U drh
Z 3735bc72c61a220065b296aebe8a3b9c Z 60f1523be64826a7825849d4d0d5f745

View File

@ -1 +1 @@
7a63539169a384960e30a63e0c8e9b0f07fa431e 145cd13e3c5a42a717807bcc13c0f7212f38bff8