Re: BUG #19612: SEGV in ParseConfigFp() in guc-file.l

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>
Cc: ilia(dot)kashintsev(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19612: SEGV in ParseConfigFp() in guc-file.l
Date: 2026-08-13 08:27:42
Message-ID: an1__bbJ4MNfy9Lp@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Aug 11, 2026 at 11:30:03AM +0500, Andrey Rachitskiy wrote:
> Commit 4b496a3583e already marked the YY_BUFFER_STATE local volatile
> for that longjmp path. Commit d663f150b5e made the scanner reentrant
> and added a yyscan_t local used in the same cleanup. That local is
> written after sigsetjmp and read after siglongjmp, but was not
> volatile, so its value is indeterminate after the jump.

Asan failure reproduced, thanks. Your patch has missed the following
piece with yylex_init():
guc-file.l:387:17: warning: passing 'volatile yyscan_t *' (aka 'void
*volatile *') to parameter of type 'yyscan_t *' (aka 'void **')
discards qualifiers
[-Wincompatible-pointer-types-discards-qualifiers] 387 | if
(yylex_init(&scanner) != 0)

I am wondering whether we should just use a non-volatile copy of
"scanner", just for the sake of yylex_init(). The attached seems to
work fine here with asan.

Thoughts?
--
Michael

Attachment Content-Type Size
asan-guc-file-l.patch text/plain 1.4 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrey Rachitskiy 2026-08-13 09:00:58 Re: BUG #19612: SEGV in ParseConfigFp() in guc-file.l
Previous Message Paul A Jungwirth 2026-08-12 23:18:59 Re: DELETE FOR PORTION OF bypasses view WITH CHECK OPTION for leftover rows