Avoid overflow with simplehash

Поиск
Список
Период
Сортировка
От Ranier Vilela
Тема Avoid overflow with simplehash
Дата
Msg-id CAEudQAocXNJ6s1VLz+hMamLAQAiewRoW17OJ6-+9GACKfj6iPQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Avoid overflow with simplehash  (Daniel Gustafsson <daniel@yesql.se>)
Список pgsql-hackers
Hi,

SimpleHash.

The function SH_START_ITERATE can trigger some overflow.

See:
typedef struct SH_ITERATOR
{
uint32 cur; /* current element */
uint32 end;
bool done; /* iterator exhausted? */
} SH_ITERATOR;

The cur field is uint32 size and currently can be stored a uint64,
which obviously does not fit.

Also, the current index is int, which is possibly insufficient 
since items can be up to uint32.

Attached a fix.

best regards,
Ranier Vilela

Вложения

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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Schema variables - new implementation for Postgres 15
Следующее
От: Amit Langote
Дата:
Сообщение: Re: generic plans and "initial" pruning