diff options
author | drh <> | 2024-01-29 21:09:56 +0000 |
---|---|---|
committer | drh <> | 2024-01-29 21:09:56 +0000 |
commit | 91981fe74e223f3fec2b354535e9fac437868765 (patch) | |
tree | e9c79e289f7c6d68adee37f040b190ee1c75a9c8 /src/json.c | |
parent | af3824d5fa56c7ab892dda7f929940a6eaa66b35 (diff) | |
download | sqlite-91981fe74e223f3fec2b354535e9fac437868765.tar.gz sqlite-91981fe74e223f3fec2b354535e9fac437868765.zip |
Detect malformed nested JSONB earlier and stop rendering to avoid long
delays.
FossilOrigin-Name: 72f3e1d0eca2b9ebd7c4b4cdccc6d7a0173b2fdb204cb1aa207917aedab6098a
Diffstat (limited to 'src/json.c')
-rw-r--r-- | src/json.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/json.c b/src/json.c index 2f0243651..b683e65a9 100644 --- a/src/json.c +++ b/src/json.c @@ -2274,6 +2274,7 @@ static u32 jsonTranslateBlobToText( j = jsonTranslateBlobToText(pParse, j, pOut); jsonAppendChar(pOut, ','); } + if( j>iEnd ) pOut->eErr |= JSTRING_MALFORMED; if( sz>0 ) jsonStringTrimOneChar(pOut); jsonAppendChar(pOut, ']'); break; @@ -2287,7 +2288,7 @@ static u32 jsonTranslateBlobToText( j = jsonTranslateBlobToText(pParse, j, pOut); jsonAppendChar(pOut, (x++ & 1) ? ',' : ':'); } - if( x & 1 ) pOut->eErr |= JSTRING_MALFORMED; + if( (x & 1)!=0 || j>iEnd ) pOut->eErr |= JSTRING_MALFORMED; if( sz>0 ) jsonStringTrimOneChar(pOut); jsonAppendChar(pOut, '}'); break; |