aboutsummaryrefslogtreecommitdiff
path: root/src/json.c
diff options
context:
space:
mode:
authordrh <>2023-10-09 12:57:03 +0000
committerdrh <>2023-10-09 12:57:03 +0000
commit0dead8d3d1e73e57ba452babfee121e9e3141dfc (patch)
tree29a1c2fc307ba99716a32e62741e561210de927d /src/json.c
parenta7e9386e889151ca062688190468e361a7e7e21d (diff)
parentfaef28e6bd654e5061561423cb1ece6ca84f1f1f (diff)
downloadsqlite-0dead8d3d1e73e57ba452babfee121e9e3141dfc.tar.gz
sqlite-0dead8d3d1e73e57ba452babfee121e9e3141dfc.zip
Merge the latest trunk fixes and enhancements into the jsonb branch, and
especially the JSON cache spill UAF fix. FossilOrigin-Name: 9422c24f4a8b290dcae61e50ec81be5b314b22c61a2bca1e194e47da1316b6e6
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/json.c b/src/json.c
index 139ffb459..d4367324d 100644
--- a/src/json.c
+++ b/src/json.c
@@ -4766,6 +4766,7 @@ static void jsonReplaceFunc(
}
pParse = jsonParseCached(ctx, argv[0], ctx, argc>1);
if( pParse==0 ) return;
+ pParse->nJPRef++;
for(i=1; i<(u32)argc; i+=2){
zPath = (const char*)sqlite3_value_text(argv[i]);
pParse->useMod = 1;
@@ -4778,6 +4779,7 @@ static void jsonReplaceFunc(
jsonReturnNodeAsJson(pParse, pParse->aNode, ctx, 1);
replace_err:
jsonDebugPrintParse(pParse);
+ jsonParseFree(pParse);
}
@@ -4813,6 +4815,7 @@ static void jsonSetFunc(
}
pParse = jsonParseCached(ctx, argv[0], ctx, argc>1);
if( pParse==0 ) return;
+ pParse->nJPRef++;
for(i=1; i<(u32)argc; i+=2){
zPath = (const char*)sqlite3_value_text(argv[i]);
bApnd = 0;
@@ -4829,9 +4832,8 @@ static void jsonSetFunc(
}
jsonDebugPrintParse(pParse);
jsonReturnNodeAsJson(pParse, pParse->aNode, ctx, 1);
-
jsonSetDone:
- /* no cleanup required */;
+ jsonParseFree(pParse);
}
/*