Potential issue in ecpg-informix decimal converting functions

Поиск
Список
Период
Сортировка
От a.imamov@postgrespro.ru
Тема Potential issue in ecpg-informix decimal converting functions
Дата
Msg-id 54d2b53327516d9454daa5fb2f893bdc@postgrespro.ru
обсуждение исходный текст
Ответы Re: Potential issue in ecpg-informix decimal converting functions
Список pgsql-hackers
Hi, everyone!

I found a potential bug in dectoint() and dectolong() functions from
informix.c. "Informix Compatibility Mode" doc chapter says that
ECPG_INFORMIX_NUM_OVERFLOW is returned if an overflow occurred. But
check this line in dectoint() or dectolong() (it is present in both):
if (ret == PGTYPES_NUM_OVERFLOW) - condition is always
false because PGTYPESnumeric_to_int() and PGTYPESnumeric_to_long()
functions return only 0 or -1. So ECPG_INFORMIX_NUM_OVERFLOW can never
be returned.

I think dectoint(), dectolong() and PGTYPESnumeric_to_int() functions
should be a little bit different like in proposing patch.
What do you think?

The flaw was catched with the help of Svace static analyzer.
https://svace.pages.ispras.ru/svace-website/en/

Thank you!
Вложения

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

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: Sequence Access Methods, round two
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Experiments with Postgres and SSL