Re: Move allocation size overflow handling to MemoryContextAllocExtended()?

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Move allocation size overflow handling to MemoryContextAllocExtended()?
Дата
Msg-id CAB7nPqSTnj_6nFz=diYt7WciMSv4Dw=GF8T-4ffNXbH0QK2imw@mail.gmail.com
обсуждение исходный текст
Ответ на Move allocation size overflow handling to MemoryContextAllocExtended()?  (Andres Freund <andres@anarazel.de>)
Ответы Re: Move allocation size overflow handling to MemoryContextAllocExtended()?  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On Wed, Oct 5, 2016 at 8:56 AM, Andres Freund <andres@anarazel.de> wrote:
> That made me wonder if it's not actually a mistake for
> MemoryContextAllocExtended() size parameter to be declared
> Size/size_t. That prevents it from detecting such overflows, forcing
> code like the above on callsites.
>
> Comments?

The existing interface of MemoryContextAlloc do not care much about
anything except Size, so I'd just give the responsability to the
caller to do checks like queue != (Size) queue when queue is a uint64
for example. And I can see that your patch is using uint32 for
SH_TYPE->size.--
Michael



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Move allocation size overflow handling to MemoryContextAllocExtended()?
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Move allocation size overflow handling to MemoryContextAllocExtended()?