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

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Vadim Shakirov <vadimsakirov5(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH v1] Fix out-of-bounds access in pg_bsd_indent's parser stack
Date: 2026-09-30 11:12:01
Message-ID: BB30A199-C1B6-4185-BD0B-A40BE5657A1C@yesql.se
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 30 Sep 2026, at 12:51, Vadim Shakirov <vadimsakirov5(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2026-09-30 11:42:05 Re: ZSTD TOAST compression, and an extensible compression method encoding
Previous Message kedar anavardekar 2026-09-30 11:10:27 Re: Proposal: Conflict log history table for Logical Replication