-C Move\sdatatype\sand\sstructure\sdefinitions\sup\snear\sthe\stop\sin\sthe\sCLI\ssource\scode,\nto\sfacilitate\sfuture\schanges.\s\sNo\schanges\sto\sthe\sactual\slogic\s(yet).
-D 2026-03-23T21:03:34.220
+C Recognize\sartifical\sJSONB\sblobs\swith\sdeep\srecursion\sas\sbeing\sill-formed.
+D 2026-03-24T00:31:28.162
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F src/hwtime.h 21c2cf1f736e7b97502c3674d0c386db3f06870d6f10d0cf8174e2a4b8cb726e
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
F src/insert.c dfd311b0ac2d4f6359e62013db67799757f4d2cc56cca5c10f4888acfbbfa3fd
-F src/json.c 7401618493219bb605408be48d2ea5ed5c9055f1c3b733268331eb0174048746
+F src/json.c 5768278f0d25c8a29f260efb6cb66ddbdb635de7d3d0f2b6da1d11e9f5989876
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 187929338d21f43cbdea359a3c1ec61294f39b7f9032e824c1dbb79f9994c838
F src/main.c 31a13302193fbd51279c7e69cdfa0320d0de7629f9151e0964c1d320e8bdd7a4
F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
-P 3342d6786e07d3d8dd4b1f2291edea9f8354d384ff21242cc513c218ce6f1630
-R 8c5c587dcf1bcb89f63fe198495d5592
+P 6b3d84d34d1a84eb8ddff08cd85d9dff6e71099e7a4b2c19db8774d942d3a040
+R 5eb812c0a84e63f8ff00aeb0693e545a
U drh
-Z f5602963f831d7a71bfe866ee1f1efbc
+Z 1b6a6a92fadad7a1745dc38064bea53f
# Remove this line to create a well-formed Fossil manifest.
**************************************************************************/
static void jsonReturnStringAsBlob(JsonString*);
static int jsonArgIsJsonb(sqlite3_value *pJson, JsonParse *p);
-static u32 jsonTranslateBlobToText(const JsonParse*,u32,JsonString*);
+static u32 jsonTranslateBlobToText(JsonParse*,u32,JsonString*);
static void jsonReturnParse(sqlite3_context*,JsonParse*);
static JsonParse *jsonParseFuncArg(sqlite3_context*,sqlite3_value*,u32);
static void jsonParseFree(JsonParse*);
** The pOut->eErr JSTRING_OOM flag is set on a OOM.
*/
static u32 jsonTranslateBlobToText(
- const JsonParse *pParse, /* the complete parse of the JSON */
+ JsonParse *pParse, /* the complete parse of the JSON */
u32 i, /* Start rendering at this index */
JsonString *pOut /* Write JSON here */
){
jsonAppendChar(pOut, '[');
j = i+n;
iEnd = j+sz;
+ if( ++pParse->iDepth > JSON_MAX_DEPTH ){
+ jsonStringOom(pOut);
+ }
while( j<iEnd && pOut->eErr==0 ){
j = jsonTranslateBlobToText(pParse, j, pOut);
jsonAppendChar(pOut, ',');
}
+ pParse->iDepth--;
if( j>iEnd ) pOut->eErr |= JSTRING_MALFORMED;
if( sz>0 ) jsonStringTrimOneChar(pOut);
jsonAppendChar(pOut, ']');
jsonAppendChar(pOut, '{');
j = i+n;
iEnd = j+sz;
+ if( ++pParse->iDepth > JSON_MAX_DEPTH ){
+ jsonStringOom(pOut);
+ }
while( j<iEnd && pOut->eErr==0 ){
j = jsonTranslateBlobToText(pParse, j, pOut);
jsonAppendChar(pOut, (x++ & 1) ? ',' : ':');
}
+ pParse->iDepth--;
if( (x & 1)!=0 || j>iEnd ) pOut->eErr |= JSTRING_MALFORMED;
if( sz>0 ) jsonStringTrimOneChar(pOut);
jsonAppendChar(pOut, '}');
u32 i /* Start rendering at this index */
){
u32 sz, n, j, iEnd;
- const JsonParse *pParse = pPretty->pParse;
+ JsonParse *pParse = pPretty->pParse;
JsonString *pOut = pPretty->pOut;
n = jsonbPayloadSize(pParse, i, &sz);
if( n==0 ){
if( j<iEnd ){
jsonAppendChar(pOut, '\n');
pPretty->nIndent++;
+ if( pPretty->nIndent >= JSON_MAX_DEPTH ){
+ jsonStringOom(pOut);
+ }
while( pOut->eErr==0 ){
jsonPrettyIndent(pPretty);
j = jsonTranslateBlobToPrettyText(pPretty, j);
if( j<iEnd ){
jsonAppendChar(pOut, '\n');
pPretty->nIndent++;
+ if( pPretty->nIndent >= JSON_MAX_DEPTH ){
+ jsonStringOom(pOut);
+ }
+ pParse->iDepth = pPretty->nIndent;
while( pOut->eErr==0 ){
jsonPrettyIndent(pPretty);
j = jsonTranslateBlobToText(pParse, j, pOut);