Re: [PATCH] bms_prev_member() can read beyond the end of the array of allocated words
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: Greg Burd <greg@burd.me>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-08-14T15:49:06Z
Lists: pgsql-hackers
On Fri, 15 Aug 2025 at 03:43, Greg Burd <greg@burd.me> wrote:
> Well, that was rushed. Apologies.
Would you be ok with adding the Assert after the "a == NULL" check?, i.e:
if (a == NULL || prevbit == 0)
return -2;
/* Validate callers didn't give us something out of range */
Assert(prevbit <= a->nwords * BITS_PER_BITMAPWORD);
David
Commits
-
Add Asserts to validate prevbit values in bms_prev_member
- b4632883d44e 19 (unreleased) landed