From 0b8b1c309d7264ecc6b24608be552d1d47e5b299 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 4 Dec 2023 19:14:13 +0000 Subject: [PATCH] Do not make the input JSONB editable in json_remove() if there are no PATH argument. FossilOrigin-Name: 66594544f3ba9977475a3e3f74404eb2b2fb845053b28bd24c2b52c7df94e9d7 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/json.c | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 7e8f87147a..e729bdb871 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\serrors\sin\srendering\sJSON5\sescape\ssequences\sembedded\sin\sJSONB. -D 2023-12-04T18:53:10.232 +C Do\snot\smake\sthe\sinput\sJSONB\seditable\sin\sjson_remove()\sif\sthere\sare\sno\sPATH\nargument. +D 2023-12-04T19:14:13.899 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -688,7 +688,7 @@ F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51 F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 -F src/json.c b3a194fc1db52f1b169d9779a0d9155b4c123e8492a921114a5381700ea6c81d +F src/json.c ab1eb1ab2ecedf193e0e1dc2ae62668e74ffd8668c39bf2014d419d175f6aae6 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36 F src/main.c 1b89f3de98d1b59fec5bac1d66d6ece21f703821b8eaa0d53d9604c35309f6f9 @@ -2145,8 +2145,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P ddf92b5059a9106753fd18b82ba8daa269a62af947561c460790107b83416f0b -R 2f4c11a457fe80bb549ac0019420b08f +P f1a51ae3863557526a51c6e98e71fcdf4f1ed14a36212b3c90f7408f926345e4 +R fedbc77310dd69998d8c7dc42f0e4ac1 U drh -Z 9def50f1dac0c1957715ee3f6f843ba7 +Z e47b61cc62bf0572c657f0a0469cf19a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 030ca873ab..4c9ef95e4c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f1a51ae3863557526a51c6e98e71fcdf4f1ed14a36212b3c90f7408f926345e4 \ No newline at end of file +66594544f3ba9977475a3e3f74404eb2b2fb845053b28bd24c2b52c7df94e9d7 \ No newline at end of file diff --git a/src/json.c b/src/json.c index aefd47498f..97c65df0bc 100644 --- a/src/json.c +++ b/src/json.c @@ -2802,7 +2802,6 @@ rebuild_from_cache: if( n==0 || sz+n!=p->nBlob || ((p->aBlob[0] & 0x0f)<=JSONB_FALSE && sz>0) - || sz+n!=p->nBlob ){ goto json_pfa_malformed; } @@ -3556,7 +3555,7 @@ static void jsonRemoveFunc( u32 rc; /* Subroutine return code */ if( argc<1 ) return; - p = jsonParseFuncArg(ctx, argv[0], JSON_EDITABLE); + p = jsonParseFuncArg(ctx, argv[0], argc>1 ? JSON_EDITABLE : 0); if( p==0 ) return; for(i=1; i