Re: Prevent stack overflow in exprLocation while parsing long queries

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Prevent stack overflow in exprLocation while parsing long queries
Date: 2026-11-26 13:23:03
Message-ID: 326656c8-8dd2-4a17-a852-05cf7dc79789@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 24/11/2026 19:36, Zsolt Parragi wrote:
> Hello
>
> In a thread about repack [1] Alvaro pointed out that the parser
> support for psql is a hack, and since I was already interested in
> making the parser available as a library for different projects I
> decided to take a look into that.
>
> Shortly after starting, Claude pointed out a trivial bug where a long
> chain can cause a stack overflow crash during error reporting.
>
> Since this requires a 1 line fix, I attached a patch for it.
>
> I'm not sure if we want to add a test case for something like this,
> but since it doesn't take much time to run or isn't too complex, the
> patch includes one.

Applied, thanks. I didn't commit the test, it'd be excessive to include
a test for every possible recursion in the system. But thanks for
including it anyway, it was useful for reviewing.

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2026-11-26 13:29:56 Re: Small cleanup of leftover pre-1.1.0 OpenSSL code
Previous Message Abraham Pérez 2026-11-26 13:22:12 Re: Mark the enum comparison functions as leakproof