From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix ASAN failure after flex errors in GUC file parsing
Date: Sun, 16 Aug 2026 23:53:56 +0000
Message-ID: <E1wvkfq-00000000qgr-3uFW@gemulon.postgresql.org> (raw)
Fix ASAN failure after flex errors in GUC file parsing
As detected by ASAN, the scanner value used when parsing GUC files can
be indeterminate when the flex error handler sigjumps to the old cleanup
path, before yylex_init() is called.
The flex scanner state is now made volatile in ParseConfigFp(), since
its value is assigned after sigsetjmp() and cna be accessed after
siglongjmp(). yylex_init() cannot use a volatile pointer; a temporary
variable is used before assigning the result of yylex_init() to it.
While on it, yy_create_buffer() is changed to detect the case where it
returns a NULL value. Based on my read of the flex code, this cannot be
reached currently. Future upstream changes or changes in the error
logic of the GUC file parsing could make that reachable, and it is four
extra lines of code.
Oversight in d663f150b5ed.
Reported-by: Ilia Kashintsev <ilia.kashintsev@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Discussion: https://postgr.es/m/19612-24ccb4fc6da7786f@postgresql.org
Backpatch-through: 18
Branch
------
REL_18_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/0391fee2dc30c801fc17a1eeb6a82448d359e052
Modified Files
--------------
src/backend/utils/misc/guc-file.l | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix ASAN failure after flex errors in GUC file parsing
In-Reply-To: <E1wvkfq-00000000qgr-3uFW@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox