aboutsummaryrefslogtreecommitdiff
path: root/src/select.c
diff options
context:
space:
mode:
authordrh <>2025-07-18 12:10:15 +0000
committerdrh <>2025-07-18 12:10:15 +0000
commit74cc109780ee33138db6e7ed076426604131b8c6 (patch)
tree3ecd297d28c2aa81e60d437c03219386e9b51ad2 /src/select.c
parent01a2953350395ca3b0962c9a0245db847f271b82 (diff)
downloadsqlite-74cc109780ee33138db6e7ed076426604131b8c6.tar.gz
sqlite-74cc109780ee33138db6e7ed076426604131b8c6.zip
Ensure that the accumulator for an aggregate always gets initialized,
even when the aggregate is on the right side of a LEFT JOIN and never gets evaluated. This fixes a problem introduced by [663f5dd32d9db832] and found by dbsqlfuzz. Test cases in TH3. FossilOrigin-Name: 235cf6586b9ac914a32bd8adfd460daae998687f02f0998a7aa3c6bfc857d1c9
Diffstat (limited to 'src/select.c')
-rw-r--r--src/select.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/select.c b/src/select.c
index 1b1266313..665c30933 100644
--- a/src/select.c
+++ b/src/select.c
@@ -8482,6 +8482,7 @@ int sqlite3Select(
sqlite3VdbeAddOp2(v, OP_Integer, 0, iAbortFlag);
VdbeComment((v, "clear abort flag"));
sqlite3VdbeAddOp3(v, OP_Null, 0, iAMem, iAMem+pGroupBy->nExpr-1);
+ sqlite3ExprNullRegisterRange(pParse, iAMem, pGroupBy->nExpr);
/* Begin a loop that will extract all source rows in GROUP BY order.
** This might involve two separate loops with an OP_Sort in between, or