diff options
author | drh <drh@noemail.net> | 2016-11-07 15:15:42 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2016-11-07 15:15:42 +0000 |
commit | 27b2d1b88b432d7145bb7ba540e8d6552a91d89f (patch) | |
tree | 5f36fda698df91cf775ddeb66cdb27b491cc6831 /ext/misc/json1.c | |
parent | ad875e741601ea1fa749c18047ce8c1f34e8c510 (diff) | |
download | sqlite-27b2d1b88b432d7145bb7ba540e8d6552a91d89f.tar.gz sqlite-27b2d1b88b432d7145bb7ba540e8d6552a91d89f.zip |
Replace some unreachable branches from the JSON1 extension with assert().
FossilOrigin-Name: 145cd13e3c5a42a717807bcc13c0f7212f38bff8
Diffstat (limited to 'ext/misc/json1.c')
-rw-r--r-- | ext/misc/json1.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ext/misc/json1.c b/ext/misc/json1.c index 839e133bf..df6aa7324 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<n-2; i++, k++){ + for(k=0; k<4; i++, k++){ + assert( i<n-2 ); c = z[i+1]; - if( c>='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 ){ |