diff options
author | drh <> | 2023-11-09 01:54:26 +0000 |
---|---|---|
committer | drh <> | 2023-11-09 01:54:26 +0000 |
commit | c060b5f3a880e487e4ee6008317bef593fb6e5cf (patch) | |
tree | cb840f93bcc189326b5813fa6899b29bc52f1f99 /src | |
parent | b494366370f5f9698e574150c5a4309d7c3dc78b (diff) | |
download | sqlite-c060b5f3a880e487e4ee6008317bef593fb6e5cf.tar.gz sqlite-c060b5f3a880e487e4ee6008317bef593fb6e5cf.zip |
JSON5 bug fix: Escape double-quotes that occur inside of single-quoted strings.
[forum:/forumpost/ddcad3e884|Forum post ddcad3e884].
FossilOrigin-Name: 1c98d46d60ef1494bd8b7561c7d0cd5aafc178201a6f1f0da25dea6140b91cd0
Diffstat (limited to 'src')
-rw-r--r-- | src/json.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/json.c b/src/json.c index 407ca2d0e..91b96df37 100644 --- a/src/json.c +++ b/src/json.c @@ -432,13 +432,19 @@ static void jsonAppendNormalizedString(JsonString *p, const char *zIn, u32 N){ zIn++; N -= 2; while( N>0 ){ - for(i=0; i<N && zIn[i]!='\\'; i++){} + for(i=0; i<N && zIn[i]!='\\' && zIn[i]!='"'; i++){} if( i>0 ){ jsonAppendRawNZ(p, zIn, i); zIn += i; N -= i; if( N==0 ) break; } + if( zIn[0]=='"' ){ + jsonAppendRawNZ(p, "\\\"", 2); + zIn++; + N--; + continue; + } assert( zIn[0]=='\\' ); switch( (u8)zIn[1] ){ case '\'': |