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

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Greg Burd <greg(at)burd(dot)me>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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 15:49:06
Message-ID: CAApHDvpi6LgxtoV=XhTfbsXYa2gULy=JoCxen8s_OszFhAO7bA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 15 Aug 2025 at 03:43, Greg Burd <greg(at)burd(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2025-08-14 15:52:07 Re: don't include tableam.h in nbtree.h
Previous Message Tom Lane 2025-08-14 15:46:17 Re: [PATCH] Silence Valgrind about SelectConfigFiles()