| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix ASAN failure after flex errors in GUC file parsing |
| Date: | 2026-08-16 23:53:55 |
| Message-ID: | E1wvkfq-00000000qgn-3ke2@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(dot)kashintsev(at)gmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Reviewed-by: Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>
Discussion: https://postgr.es/m/19612-24ccb4fc6da7786f@postgresql.org
Backpatch-through: 18
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/803583ce74d37c27167bd4d1c9e9dd2421735943
Modified Files
--------------
src/backend/utils/misc/guc-file.l | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-08-16 23:53:56 | pgsql: Fix ASAN failure after flex errors in GUC file parsing |
| Previous Message | Jeff Davis | 2026-08-15 16:54:36 | pgsql: Clarify logic in CreateSubscription(). |