diff options
author | drh <> | 2023-04-27 23:29:09 +0000 |
---|---|---|
committer | drh <> | 2023-04-27 23:29:09 +0000 |
commit | 52da6d26074a6aa3e3aed0e16b18a91b068490ca (patch) | |
tree | f918cda7b05d7146c5e6ffbb74d4f803be6fd185 /src | |
parent | ae31f48826a250096945ab1494dad4c1c30852ee (diff) | |
download | sqlite-52da6d26074a6aa3e3aed0e16b18a91b068490ca.tar.gz sqlite-52da6d26074a6aa3e3aed0e16b18a91b068490ca.zip |
Test cases added, and some bugs fixed.
FossilOrigin-Name: bc84a82e4ddc1b71025c56c49e62a44f0b12fa87a6417ad61967d9d3121a0d4e
Diffstat (limited to 'src')
-rw-r--r-- | src/json.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/json.c b/src/json.c index 72ec1af10..6bac63ec5 100644 --- a/src/json.c +++ b/src/json.c @@ -816,7 +816,7 @@ static void jsonReturn( }else if( 0xe2==(u8)c ){ assert( 0x80==(u8)z[i+1] ); assert( 0xa8==(u8)z[i+2] || 0xa9==(u8)z[i+2] ); - i+= 2; + i += 2; continue; }else{ continue; @@ -1221,13 +1221,17 @@ json_parse_restart: || c=='n' || c=='r' || c=='t' || (c=='u' && jsonIs4Hex(&z[j+1])) ){ jnFlags |= JNODE_ESCAPE; - }else if( c=='\'' || c=='0' || c=='v' - || c=='\r' || c=='\n' + }else if( c=='\'' || c=='0' || c=='v' || c=='\n' || (0xe2==(u8)c && 0x80==(u8)z[j+1] && (0xa8==(u8)z[j+2] || 0xa9==(u8)z[j+2])) || (c=='x' && jsonIs2Hex(&z[j+1])) ){ jnFlags |= (JNODE_ESCAPE|JNODE_JSON5); pParse->has5 = 1; + }else if( c=='\r' ){ + j++; + if( z[j+1]=='\n' ) j++; + jnFlags |= (JNODE_ESCAPE|JNODE_JSON5); + pParse->has5 = 1; }else{ return -1; } @@ -1270,7 +1274,7 @@ json_parse_restart: pParse->has5 = 1; jnFlags = JNODE_JSON5; seenE = 0; - seenDP = 1; + seenDP = JSON_REAL; goto parse_number_2; } return -1; @@ -1335,6 +1339,11 @@ json_parse_restart: return i+4; } #endif + if( z[i+1]=='.' ){ + pParse->has5 = 1; + jnFlags |= JNODE_JSON5; + goto parse_number_2; + } return -1; } if( z[i+1]=='0' ){ @@ -1355,7 +1364,6 @@ json_parse_restart: c = z[j]; if( sqlite3Isdigit(c) ) continue; if( c=='.' ){ - if( z[j-1]=='-' ) return -1; if( seenDP==JSON_REAL ) return -1; seenDP = JSON_REAL; continue; |