This is an automated email from the ASF dual-hosted git repository.

yjhjstz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 6584d1bfe08da124ddeb139d5c17ad8e30fc02a2
Author: Jianghua Yang <[email protected]>
AuthorDate: Fri Jan 3 16:33:49 2025 +0800

    fix: Add bounds checking for aggregate filter array access
    
    Prevent potential array out of bounds access by validating the expression ID
    is within the valid range of distinct qualified aggregates before accessing
    the aggregate filter array.
---
 src/backend/executor/nodeTupleSplit.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/backend/executor/nodeTupleSplit.c 
b/src/backend/executor/nodeTupleSplit.c
index 19a6b49c25..90d14d3622 100644
--- a/src/backend/executor/nodeTupleSplit.c
+++ b/src/backend/executor/nodeTupleSplit.c
@@ -187,7 +187,10 @@ ExecTupleSplit(PlanState *pstate)
                econtext->ecxt_outertuple = node->outerslot;
 
                /* The filter is pushed down from relative DQA */
-               ExprState * filter = 
node->agg_filter_array[node->currentExprId];
+               ExprState * filter = NULL;
+               if (node->currentExprId < node->numDisDQAs)
+                       filter = node->agg_filter_array[node->currentExprId];
+
                if (filter)
                {
                        Datum           res;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to