From 3117b7b081d782c5da91da94a03cf135ed05533d Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 19 Apr 2022 18:23:01 +0000 Subject: [PATCH] Fix a NULL-pointer dereference that can occur on an aggregate query that uses FULL JOIN. dbsqlfuzz 496a35dd4eefcd7935aaaeb0c69056bf49785d28. FossilOrigin-Name: 63b8f8aec2a9ac3fbbd02715aa308eaf43c9ffde9d7c6db026d46edc575e7bdd --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/select.c | 4 +++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 0ed381f292..2052de4c10 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Mark\san\sunreachable\s"just-in-case"\sbranch\sas\sunreachable. -D 2022-04-19T15:56:03.282 +C Fix\sa\sNULL-pointer\sdereference\sthat\scan\soccur\son\san\saggregate\squery\sthat\nuses\sFULL\sJOIN.\s\sdbsqlfuzz\s496a35dd4eefcd7935aaaeb0c69056bf49785d28. +D 2022-04-19T18:23:01.497 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -552,7 +552,7 @@ F src/printf.c 05d8dfd2018bc4fc3ddb8b37eb97ccef7abf985643fa1caebdcf2916ca90fa32 F src/random.c 097dc8b31b8fba5a9aca1697aeb9fd82078ec91be734c16bffda620ced7ab83c F src/resolve.c a3d58967025858f0f61b7b5d6c45914650acce05c33e4379a43ca4d042a68573 F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92 -F src/select.c 50051eee5a598bd4ec5e47daeb3e20294bb98002d3a8bd8adbb1fef2b47cd980 +F src/select.c 6fa15ee07a8da8198e74f0092f681dd5f572e9e14b756dd140e0bba18a53bed7 F src/shell.c.in ecff6f4ab0e8e25acd578b3eb27ac0bad4d48643c160259a277151d6e9d412e1 F src/sqlite.h.in 2a35f62185eb5e7ecc64a2f68442b538ce9be74f80f28a00abc24837edcf1c17 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 @@ -1950,8 +1950,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 78d58e461f99366d2749ccd6d02ab4cba0cab20bb80c097e7128da1e50303549 -R 8b7a68ba170d685963d5182430216b5b +P b966d52437f08a6759a83a45cafb0d706a8933a8e55dee38ae78166d1a5b3ba4 +R 700d351d60353bc6a3752c8bca1af8cc U drh -Z abc8af7302efb06e9c77f2c011b16ae4 +Z 79f7f3b783582a1aa6157ba5326441d3 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 79ca8ed8af..65ce384d8b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b966d52437f08a6759a83a45cafb0d706a8933a8e55dee38ae78166d1a5b3ba4 \ No newline at end of file +63b8f8aec2a9ac3fbbd02715aa308eaf43c9ffde9d7c6db026d46edc575e7bdd \ No newline at end of file diff --git a/src/select.c b/src/select.c index a59e50674e..6ebc1dc3cb 100644 --- a/src/select.c +++ b/src/select.c @@ -7606,7 +7606,9 @@ int sqlite3Select( updateAccumulator(pParse, regAcc, pAggInfo, eDist); if( eDist!=WHERE_DISTINCT_NOOP ){ struct AggInfo_func *pF = &pAggInfo->aFunc[0]; - fixDistinctOpenEph(pParse, eDist, pF->iDistinct, pF->iDistAddr); + if( pF ){ + fixDistinctOpenEph(pParse, eDist, pF->iDistinct, pF->iDistAddr); + } } if( regAcc ) sqlite3VdbeAddOp2(v, OP_Integer, 1, regAcc);