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

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: [PATCH] bms_prev_member() can read beyond the end of the array of allocated words
Дата
Msg-id CAApHDvqRFbGZx_7FZ-VjVj8m6XzX_Hzmz=FbOvO6fGhNx0EggQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] bms_prev_member() can read beyond the end of the array of allocated words  (Greg Burd <greg@burd.me>)
Ответы Re: [PATCH] bms_prev_member() can read beyond the end of the array of allocated words
Список pgsql-hackers
On Fri, 15 Aug 2025 at 02:21, Greg Burd <greg@burd.me> wrote:
> I found this too, and also the "one above" part seemed wrong to me as well.

It is valid to pass prevbit as a->nwords * BITS_PER_BITMAPWORD as the
code does "prevbit--;". Maybe it would be less confusing if it were
written as:

 * "prevbit" must be less than or equal to "a->nwords * BITS_PER_BITMAPWORD".

The Assert should be using <= rather than <.

David



В списке pgsql-hackers по дате отправления: