From 27b2d1b88b432d7145bb7ba540e8d6552a91d89f Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 7 Nov 2016 15:15:42 +0000 Subject: [PATCH] Replace some unreachable branches from the JSON1 extension with assert(). FossilOrigin-Name: 145cd13e3c5a42a717807bcc13c0f7212f38bff8 --- ext/misc/json1.c | 11 ++++++----- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/ext/misc/json1.c b/ext/misc/json1.c index 839e133bf2..df6aa73247 100644 --- a/ext/misc/json1.c +++ b/ext/misc/json1.c @@ -595,12 +595,13 @@ static void jsonReturn( c = z[++i]; if( c=='u' ){ u32 v = 0, k; - for(k=0; k<4 && i='0' && c<='9' ) v = v*16 + c - '0'; - else if( c>='A' && c<='F' ) v = v*16 + c - 'A' + 10; - else if( c>='a' && c<='f' ) v = v*16 + c - 'a' + 10; - else break; + assert( safe_isxdigit(c) ); + if( c<='9' ) v = v*16 + c - '0'; + else if( c<='F' ) v = v*16 + c - 'A' + 10; + else v = v*16 + c - 'a' + 10; } if( v==0 ) break; if( v<=0x7f ){ diff --git a/manifest b/manifest index 8ea3d627b0..754789c49f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\sJSON1\sextension\sso\sthat\sthe\sJSON\svalidator\scorrectly\srejects\smalformed\nbackslash\sescapes\swithin\sstring\sliterals. -D 2016-11-07T13:37:28.861 +C Replace\ssome\sunreachable\sbranches\sfrom\sthe\sJSON1\sextension\swith\sassert(). +D 2016-11-07T15:15:42.501 F Makefile.in 6fd48ffcf7c2deea7499062d1f3747f986c19678 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc e0217f2d35a0448abbe4b066132ae20136e8b408 @@ -213,7 +213,7 @@ F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2 F ext/misc/fileio.c d4171c815d6543a9edef8308aab2951413cd8d0f F ext/misc/fuzzer.c 7c64b8197bb77b7d64eff7cac7848870235d4c25 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/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342 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.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b86b79c442a58d10aa005ba4f34095375a88d242 -R 7a809bd65e85c52e8075f2c4e33138f7 +P 7a63539169a384960e30a63e0c8e9b0f07fa431e +R 301a8516f843000230cab1da4034b3ce U drh -Z 3735bc72c61a220065b296aebe8a3b9c +Z 60f1523be64826a7825849d4d0d5f745 diff --git a/manifest.uuid b/manifest.uuid index 5fedc2cefc..e396626575 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7a63539169a384960e30a63e0c8e9b0f07fa431e \ No newline at end of file +145cd13e3c5a42a717807bcc13c0f7212f38bff8 \ No newline at end of file