Re: [PATCH v1] Fix out-of-bounds access in pg_bsd_indent's parser stack - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: [PATCH v1] Fix out-of-bounds access in pg_bsd_indent's parser stack
Date
Msg-id BB30A199-C1B6-4185-BD0B-A40BE5657A1C@yesql.se
Whole thread
In response to [PATCH v1] Fix out-of-bounds access in pg_bsd_indent's parser stack  (Vadim Shakirov <vadimsakirov5@gmail.com>)
Responses Re: [PATCH v1] Fix out-of-bounds access in pg_bsd_indent's parser stack
List pgsql-hackers
> On 30 Sep 2026, at 12:51, Vadim Shakirov <vadimsakirov5@gmail.com> wrote:
>
> parser_state stores parser state in p_stack, il, and cstk, which
> share the tos index.  The existing overflow check used p_stack, the
> largest array, allowing out-of-bounds accesses to cstk and il.  Size
> all three arrays equally.
>
> Also widen the overflow check by one element: the lbrace case pushes
> two entries (lbrace and then stmt), so there must be room for two
> more elements when parse() is entered.

I haven't read the patch, but reproducers of bugs are good to have.  Is there a
pattern which hits this out-of-bounds access?

--
Daniel Gustafsson




pgsql-hackers by date:

Previous
From: kedar anavardekar
Date:
Subject: Re: Proposal: Conflict log history table for Logical Replication
Next
From: Hannu Krosing
Date:
Subject: Re: ZSTD TOAST compression, and an extensible compression method encoding