pgsql: Fix null-pointer crash in ECPG compiler.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix null-pointer crash in ECPG compiler.
Date: 2026-06-25 20:58:33
Message-ID: E1wcr9d-000CRr-1T@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix null-pointer crash in ECPG compiler.

When compiling a DECLARE section containing a union nested
inside a struct, ecpg passes a null value for struct_sizeof to
ECPGmake_struct_type. I (tgl) didn't foresee that case in
commit 0e6060790, and wrote an unprotected mm_strdup() call.

Reported-by: iMSA (via Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com>)
Author: Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/20260625114849.34b2148e@karst
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7f5e0b22e5eabf7b794b5059efa9454ba3616afe

Modified Files
--------------
src/interfaces/ecpg/preproc/type.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Masahiko Sawada 2026-06-25 21:26:10 pgsql: Mark uuid-to-bytea cast as leakproof.
Previous Message Amit Langote 2026-06-25 11:45:12 pgsql: Avoid ABI break in ModifyTableState from the FDW pruning fix