[PATCH] work_mem calculation possible overflow

Поиск
Список
Период
Сортировка
От David Rowley
Тема [PATCH] work_mem calculation possible overflow
Дата
Msg-id CAApHDvqMg=1tYjeQBFiRadRotp0L3ZCM2RzPXQ9xF8yFKF8oSA@mail.gmail.com
обсуждение исходный текст
Ответы Re: [PATCH] work_mem calculation possible overflow
Список pgsql-hackers
I was just looking through a few of the warnings flagged up by PVS Studio.
I found some warnings around some calculations that were doing work_mem * 1024L and comparing that to a double. On windows 64 sizeof(long) is 4 bytes.
Currently work_mem's maximum value is INT_MAX / 1024, so this should not overflow on windows 64 at the moment, but perhaps if work_mem's maximum is raised in the future then it will. In any case the L suffix on 1024 to widen the type here just seems a bit wrong giving that postgresql supports platforms where sizeof(int) and sizeof(long) is the same.

Its very possible that there are more pressing things to fix from the PVS Studio's list, but I thought I'd have a go at doing a bit of weeding and try reducing the list a bit.

Patch attached.

Regards

David Rowley
Вложения

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

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: preserving forensic information when we freeze
Следующее
От: "MauMau"
Дата:
Сообщение: Re: [bug fix] connection service file doesn't take effect with ECPG apps