Re: [PATCH] bms_prev_member() can read beyond the end of the array of allocated words

From: Greg Burd <greg(at)burd(dot)me>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] bms_prev_member() can read beyond the end of the array of allocated words
Date: 2025-08-14 14:21:37
Message-ID: 266D00F2-4FE3-4352-ABE6-34ECB69BBFFC@getmailspring.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Aug 14 2025, at 10:06 am, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> David Rowley <dgrowleyml(at)gmail(dot)com> writes:
>> There's a comment saying:
>> * "prevbit" must NOT be more than one above the highest possible bit
>> that can
>> * be set at the Bitmapset at its current size.
>> 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?

Hey Tom, thanks for chiming in on this one. I had the same idea and
sent an updated patch.

-greg

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

I found this too, and also the "one above" part seemed wrong to me as well.

>
> regards, tom lane

best.

-greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Borisov 2025-08-14 14:41:42 Re: Improve the performance of Unicode Normalization Forms.
Previous Message Greg Burd 2025-08-14 14:19:55 Re: [PATCH] bms_prev_member() can read beyond the end of the array of allocated words