Slightly stricter testing for when a BLOB is valid JSONB: If the element

is a null, true, or false, its payload size must be zero.

FossilOrigin-Name: 487781be8a93d9b8d870efb9f25822bb4bbcf9d39d571d1017e9c29043ea515d
This commit is contained in:
drh 2023-10-05 16:33:00 +00:00
parent 01acfd5805
commit 0585d9f08f
3 changed files with 9 additions and 7 deletions

View File

@ -1,5 +1,5 @@
C Fix\sa\smemory\sleak\sfollowing\sa\ssyntax\serror\sin\sjsonb(). C Slightly\sstricter\stesting\sfor\swhen\sa\sBLOB\sis\svalid\sJSONB:\s\sIf\sthe\selement\nis\sa\snull,\strue,\sor\sfalse,\sits\spayload\ssize\smust\sbe\szero.
D 2023-10-05T15:05:33.202 D 2023-10-05T16:33:00.108
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -670,7 +670,7 @@ F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51
F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276
F src/json.c 85d3615672a130f2fd22ea6005984048953b745deb48886be72f227ba6f21f9c F src/json.c 5fce177a1fa0e0853024141e4f603cf04324833c35f1ee2484c20296236d1fa8
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 98cfba10989b3da6f1807ad42444017742db7f100a54f1032af7a8b1295912c0 F src/loadext.c 98cfba10989b3da6f1807ad42444017742db7f100a54f1032af7a8b1295912c0
F src/main.c 618aeb399e993cf561864f4b0cf6a331ee4f355cf663635f8d9da3193a46aa40 F src/main.c 618aeb399e993cf561864f4b0cf6a331ee4f355cf663635f8d9da3193a46aa40
@ -2124,8 +2124,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P bae5071b0834aa3b7fd4bd871f863e1b148c6558989c8f6cdd02dc4da4770953 P bf4b36eda8e200b67041ebdf60fc31d0325bd84185272f8d390c56a91d6ac1ee
R 4bb974d3e61cd02ec317b43011061d2f R 82f6c0430b8291dd07f3a6ba0e331be4
U drh U drh
Z be9524533dfa255e55d6b8c43429a3ea Z fe5195d3e7cce0d43ee394c132952294
# Remove this line to create a well-formed Fossil manifest. # Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
bf4b36eda8e200b67041ebdf60fc31d0325bd84185272f8d390c56a91d6ac1ee 487781be8a93d9b8d870efb9f25822bb4bbcf9d39d571d1017e9c29043ea515d

View File

@ -3415,6 +3415,8 @@ static int jsonFuncArgMightBeBinary(sqlite3_value *pJson){
s.nBlob = nBlob; s.nBlob = nBlob;
n = jsonbPayloadSize(&s, 0, &sz); n = jsonbPayloadSize(&s, 0, &sz);
if( n==0 ) return 0; if( n==0 ) return 0;
if( sz+n!=(u32)nBlob ) return 0;
if( (aBlob[0] & 0x0f)<=JSONB_FALSE && sz>0 ) return 0;
return sz+n==(u32)nBlob; return sz+n==(u32)nBlob;
} }