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: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Greg Burd <greg@burd.me>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-08-14T14:16:49Z
Lists: pgsql-hackers
On Fri, 15 Aug 2025 at 02:06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> David Rowley <dgrowleyml@gmail.com> writes:
> > So looks like it's the fault of the calling code and not an issue with
> > bms_prev_member().
>
> Yeah.  But perhaps it'd be reasonable to put in an Assert checking
> that?

Seems like a good idea.

> Grammar nitpick: comment should be more like "set in the Bitmapset".

Agreed.

David



Commits

  1. Add Asserts to validate prevbit values in bms_prev_member