diff options
author | drh <> | 2023-09-22 16:20:48 +0000 |
---|---|---|
committer | drh <> | 2023-09-22 16:20:48 +0000 |
commit | e367e453e140bb39a9df756713d28b75cff7d2e4 (patch) | |
tree | 1a75002b85b2560442fd7ef0da0f212cd131a443 /src | |
parent | c1c1d4d4a6e01a35729e4833b902901ce2cc62fa (diff) | |
download | sqlite-e367e453e140bb39a9df756713d28b75cff7d2e4.tar.gz sqlite-e367e453e140bb39a9df756713d28b75cff7d2e4.zip |
Fix minor parse-to-BLOB bugs.
FossilOrigin-Name: 8b53b2e6600c324ff7864840d98a3f03896b9792fcb60b70cc1f6227b3bd4ca1
Diffstat (limited to 'src')
-rw-r--r-- | src/json.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/json.c b/src/json.c index 6bfa0f6ce..ac8976d03 100644 --- a/src/json.c +++ b/src/json.c @@ -2480,7 +2480,7 @@ json_parse_restart: if( x<=0 ){ if( x==(-2) ){ j = pParse->iErr; - if( pParse->nBlob!=(u32)iThis+1 ) pParse->hasNonstd = 1; + if( pParse->nBlob!=(u32)iStart ) pParse->hasNonstd = 1; break; } j += json5Whitespace(&z[j]); @@ -2560,7 +2560,7 @@ json_parse_restart: pParse->iErr = j; return -1; } - if( pParse->nErr==0 ){ + if( pParse->oom==0 ){ jsonBlobChangePayloadSize(pParse, iThis, pParse->nBlob - iStart); } pParse->iDepth--; @@ -2581,7 +2581,7 @@ json_parse_restart: if( x<=0 ){ if( x==(-3) ){ j = pParse->iErr; - if( pParse->nBlob!=iThis+4 ) pParse->hasNonstd = 1; + if( pParse->nBlob!=iStart ) pParse->hasNonstd = 1; break; } if( x!=(-1) ) pParse->iErr = j; @@ -2614,7 +2614,7 @@ json_parse_restart: pParse->iErr = j; return -1; } - if( pParse->iErr==0 ){ + if( pParse->oom==0 ){ jsonBlobChangePayloadSize(pParse, iThis, pParse->nBlob - iStart); } pParse->iDepth--; @@ -3148,11 +3148,11 @@ static u32 jsonRenderBlob( n = jsonbPayloadSize(pParse, i, &sz); j = i+n; iEnd = j+sz; - while( 1 /* exit by break */ ){ + while( j<iEnd ){ j = jsonRenderBlob(pParse, j, pOut); - if( j>=iEnd ) break; jsonAppendChar(pOut, ','); } + if( sz>0 ) pOut->nUsed--; jsonAppendChar(pOut, ']'); break; } @@ -3162,11 +3162,11 @@ static u32 jsonRenderBlob( n = jsonbPayloadSize(pParse, i, &sz); j = i+n; iEnd = j+sz; - while( 1 /* edit by break */ ){ + while( j<iEnd ){ j = jsonRenderBlob(pParse, j, pOut); - if( j>=iEnd ) break; jsonAppendChar(pOut, (x++ & 1) ? ',' : ':'); } + if( sz>0 ) pOut->nUsed--; jsonAppendChar(pOut, '}'); break; } |