From e30e73c7c3e94eae47cf9dd4c31c7b760cfcaf00 Mon Sep 17 00:00:00 2001 From: Hari Krishna Sunder <12418230+hari90@users.noreply.github.com> Date: Sun, 3 May 2026 05:25:45 +0000 Subject: [PATCH] Zero-initialize parent_cpstate in analyze_cypher cypher_parsestate parent_cpstate is declared on the stack in analyze_cypher() and only pstate is explicitly set before it is passed to make_cypher_parsestate(). The latter reads parent_cpstate->subquery_where_flag (and other fields) in cypher_parse_node.c, which leaves them with indeterminate values. UBSan flagged the garbage bool (value 8) and aborted the backend. Use MemSet to zero the struct before populating pstate so all remaining members start with a defined value. --- src/backend/parser/cypher_analyze.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/backend/parser/cypher_analyze.c b/src/backend/parser/cypher_analyze.c index 7844af2f0..b2c9256ce 100644 --- a/src/backend/parser/cypher_analyze.c +++ b/src/backend/parser/cypher_analyze.c @@ -961,9 +961,8 @@ static Query *analyze_cypher(List *stmt, ParseState *parent_pstate, * convert ParseState into cypher_parsestate temporarily to pass it to * make_cypher_parsestate() */ + MemSet(&parent_cpstate, 0, sizeof(parent_cpstate)); parent_cpstate.pstate = *parent_pstate; - parent_cpstate.graph_name = NULL; - parent_cpstate.params = NULL; cpstate = make_cypher_parsestate(&parent_cpstate);