This is an automated email from the ASF dual-hosted git repository.
jrgemignani pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/age.git
The following commit(s) were added to refs/heads/master by this push:
new e9ef30b1 Zero-initialize parent_cpstate in analyze_cypher (#2423)
e9ef30b1 is described below
commit e9ef30b177040662a79dcb55307ca3b1a5cf7582
Author: Hari Krishna Sunder <[email protected]>
AuthorDate: Mon May 4 11:23:25 2026 -0700
Zero-initialize parent_cpstate in analyze_cypher (#2423)
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.
Co-authored-by: Hari Krishna Sunder
<[email protected]>
---
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 7844af2f..b2c9256c 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);