From: drh <> Date: Wed, 26 Jul 2023 11:53:14 +0000 (+0000) Subject: More comment improvements in json.c. Do not run jsonLookup() following X-Git-Tag: version-3.43.0~114^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2b5719706647a6831e2d5fadd56d04f67fc63837;p=thirdparty%2Fsqlite.git More comment improvements in json.c. Do not run jsonLookup() following an OOM error. FossilOrigin-Name: cd5fda8c2e354da7458b7c1a82ff18c5946f8dab16095bb0293bec57f6804f17 --- diff --git a/manifest b/manifest index ad979b08e4..490099b0ad 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improved\scomments\sand\sother\scleanup\sfor\sthe\schanges\son\sthis\sbranch. -D 2023-07-26T11:43:39.965 +C More\scomment\simprovements\sin\sjson.c.\s\sDo\snot\srun\sjsonLookup()\sfollowing\nan\sOOM\serror. +D 2023-07-26T11:53:14.698 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -598,7 +598,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 15ca3c2dfd5a525c225da5592f66d4ef6b789a83814f417be0a0af617071bc38 +F src/json.c c784b923a8aaa5cb514c135a74d77aec1b5c9e1cbd63764adb10d44cc678bb6e F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 176d6b2cb18a6ad73b133db17f6fc351c4d9a2d510deebdb76c22bde9cfd1465 F src/main.c 512b1d45bc556edf4471a845afb7ba79e64bd5b832ab222dc195c469534cd002 @@ -2044,8 +2044,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 134b01f37f8f741d7f7b7eda81384695d1cbe4c39751d87f08832d5c9afdcef2 -R 9df4f7348f2973215055bf0d567d169d +P bac953a80d1a541e7a12aef00c86c002133859237143ad670b39ea19799a8900 +R 968cb2bde9a2ab88d10bb801ca2ea188 U drh -Z b486171855fdc62c1515867c409e89e4 +Z 8edd1e3712b3e1a50841b71b7e4dc709 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 989660b794..979f3c9801 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bac953a80d1a541e7a12aef00c86c002133859237143ad670b39ea19799a8900 \ No newline at end of file +cd5fda8c2e354da7458b7c1a82ff18c5946f8dab16095bb0293bec57f6804f17 \ No newline at end of file diff --git a/src/json.c b/src/json.c index 8fe3116bcf..5deeb6acba 100644 --- a/src/json.c +++ b/src/json.c @@ -1841,9 +1841,10 @@ static int jsonParseFindParents(JsonParse *pParse){ #define JSON_CACHE_SZ 4 /* Max number of cache entries */ /* -** Obtain a complete parse of the JSON found in the first argument -** of the argv array. Use the sqlite3_get_auxdata() cache for this -** parse if it is available. If the cache is not available or if it +** Obtain a complete parse of the JSON found in the pJson argument +** +** Use the sqlite3_get_auxdata() cache to find a preexisting parse +** if it is available. If the cache is not available or if it ** is no longer valid, parse the JSON again and return the new parse. ** Also register the new parse so that it will be available for ** future sqlite3_get_auxdata() calls. @@ -2003,7 +2004,9 @@ static JsonNode *jsonLookupStep( ){ u32 i, j, nKey; const char *zKey; - JsonNode *pRoot = &pParse->aNode[iRoot]; + JsonNode *pRoot; + if( pParse->oom ) return 0; + pRoot = &pParse->aNode[iRoot]; while( (pRoot->jnFlags & JNODE_REPLACE)!=0 && pParse->useMod ){ u32 idx = (u32)(pRoot - pParse->aNode); i = pParse->iSubst;