diff options
author | drh <> | 2023-04-29 16:00:20 +0000 |
---|---|---|
committer | drh <> | 2023-04-29 16:00:20 +0000 |
commit | d76d954de3643e515f930c448dd31280fecb62e8 (patch) | |
tree | b120957dcdcae5f8b79b65c1200453de495e963b /src | |
parent | 64953f0fb8b5c0fdd2ffdb0ed144921c98303909 (diff) | |
download | sqlite-d76d954de3643e515f930c448dd31280fecb62e8.tar.gz sqlite-d76d954de3643e515f930c448dd31280fecb62e8.zip |
Do not allow leading zeros on non-zero numeric literals in JSON.
FossilOrigin-Name: 3e91494390ba88498eb243f61ce4ef4efa23b58326108a769bc72331d7d7d75b
Diffstat (limited to 'src')
-rw-r--r-- | src/json.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/json.c b/src/json.c index 32a52cf1e..f603a82bf 100644 --- a/src/json.c +++ b/src/json.c @@ -333,7 +333,7 @@ static void jsonAppendNormalizedString(JsonString *p, const char *zIn, u32 N){ jsonAppendRaw(p, "\\u0000", 6); break; case '\r': - if( N>=3 && zIn[2]=='\n' ){ + if( zIn[2]=='\n' ){ zIn++; N--; } @@ -1328,15 +1328,15 @@ json_parse_restart: if( c<='0' ){ if( c=='0' ){ - if( sqlite3Isdigit(z[i+1]) ){ - pParse->has5 = 1; - jnFlags = JNODE_JSON5; - }else if( (z[i+1]=='x' || z[i+1]=='X') && sqlite3Isxdigit(z[i+2]) ){ + if( (z[i+1]=='x' || z[i+1]=='X') && sqlite3Isxdigit(z[i+2]) ){ assert( seenDP==JSON_INT ); pParse->has5 = 1; jnFlags |= JNODE_JSON5; for(j=i+3; sqlite3Isxdigit(z[j]); j++){} goto parse_number_finish; + }else if( sqlite3Isdigit(z[i+1]) ){ + pParse->iErr = i+1; + return -1; } }else{ if( !sqlite3Isdigit(z[i+1]) ){ @@ -1372,8 +1372,8 @@ json_parse_restart: } if( z[i+1]=='0' ){ if( sqlite3Isdigit(z[i+2]) ){ - pParse->has5 = 1; - jnFlags = JNODE_JSON5; + pParse->iErr = i+1; + return -1; }else if( (z[i+2]=='x' || z[i+2]=='X') && sqlite3Isxdigit(z[i+3]) ){ pParse->has5 = 1; jnFlags |= JNODE_JSON5; |