1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-09 14:21:03 +03:00

Detect malformed nested JSONB earlier and stop rendering to avoid long

delays.

FossilOrigin-Name: 72f3e1d0eca2b9ebd7c4b4cdccc6d7a0173b2fdb204cb1aa207917aedab6098a
This commit is contained in:
drh
2024-01-29 21:09:56 +00:00
parent af3824d5fa
commit 91981fe74e
3 changed files with 9 additions and 8 deletions

View File

@@ -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;