Thread: Re: [Bug] Heap Use After Free in Window Aggregate Execution

Re: [Bug] Heap Use After Free in Window Aggregate Execution

From
David Rowley
Date:
On Thu, 14 Nov 2024 at 04:31, Jayesh Dehankar <jayesh.dp@zohocorp.com> wrote:
> We have discovered a bug in PostgreSQL v16.3 related to a top-level window aggregate with a partition-by clause. The
issueoccurs when the run condition fails, causing the window aggregate status to change from WINDOWAGG_RUN to
WINDOWAGG_PASSTHROUGH_STRICTmode. The bug is present in the latest STABLE branch. 

> 2) Execute below SQL queries:
> create table issue(a int, f text);
> insert into issue values (1, 'aa'), (1, 'bb');
> select * from ( select row_number() over (partition by a) as first, lead(f) over (partition by a) as third from
issue)emp where first < 1; 

Thank you for the detailed report and reproducer.

I've pushed a fix for this issue. It should be available in the 16.7
release around mid-Feb 2025.

David