Re: Fw: Re: heap_force_common in contrib/pg_surgery/heap_surgery.c has an off by one stack buffer overflow

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Ashutosh Sharma <ashu.coek88@gmail.com>
Cc: surya poondla <suryapoondla4@gmail.com>, "violin0613@tju.edu.cn" <violin0613@tju.edu.cn>, pgsql-bugs@postgresql.org
Date: 2026-06-06T00:17:00Z
Lists: pgsql-bugs
On Fri, Jun 05, 2026 at 01:30:42PM +0530, Ashutosh Sharma wrote:
> Since "offno" is already 1-based, there doesn't seem to be a need to
> subtract 1 from it and adjust the comparison accordingly.

Sure.  Changed as you have suggested here, and backpatched down to
v14.
--
Michael

Commits

  1. pg_surgery: Fix off-by-one bug with heap offset