Ensure that OOM conditions in the generation of the "bad JSON path" error

message result in an SQLITE_NOMEM error.

FossilOrigin-Name: aa0e02b5c26a2ef3d6216a0ed8bc01382be43173485f898cb63f2a8c559f2e74
This commit is contained in:
drh 2023-12-03 20:11:35 +00:00
parent 0a18a5807a
commit a3bf077b60
3 changed files with 13 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C Enable\sincorrect\sJSONB\sto\sbe\srendered\sinto\stext\swithout\shitting\san\nassertion\sfor\sa\sbad\swhitespace\sescape\sin\sa\sstring.
D 2023-12-03T19:59:45.738
C Ensure\sthat\sOOM\sconditions\sin\sthe\sgeneration\sof\sthe\s"bad\sJSON\spath"\serror\nmessage\sresult\sin\san\sSQLITE_NOMEM\serror.
D 2023-12-03T20:11:35.681
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 a575d568a65576657aad25fb7ada56007a86faf41d967ddbc80f2109caf00b0e
F src/json.c 6d92343776fe32e9d703d6e13c1d1883d75e1fd17e081159dd257b21a859f5f9
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 8dec1ba1e5076ff596756e00c1e2ada0245f168a503dd1cadadf848331acfac3
R 02988a1f4c6dc45085ceececc56fddf4
P 4d6a9a217df6792b41766b774fb0c0553b45f9104c26a0955bf4a30862d7d7bf
R 1defa3c713a22ae4567d6d3fb033b34d
U drh
Z c32b25a78a87ced6ccf27a2c8ddc3f70
Z e3833547911441ddc3c3cd95bc32393c
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
4d6a9a217df6792b41766b774fb0c0553b45f9104c26a0955bf4a30862d7d7bf
aa0e02b5c26a2ef3d6216a0ed8bc01382be43173485f898cb63f2a8c559f2e74

View File

@ -2667,8 +2667,12 @@ static char *jsonBadPathError(
){
char *zMsg = sqlite3_mprintf("bad JSON path: %Q", zPath);
if( ctx==0 ) return zMsg;
sqlite3_result_error(ctx, zMsg, -1);
sqlite3_free(zMsg);
if( zMsg ){
sqlite3_result_error(ctx, zMsg, -1);
sqlite3_free(zMsg);
}else{
sqlite3_result_error_nomem(ctx);
}
return 0;
}