Re: Bug in numeric_power() if exponent is INT_MIN

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Bug in numeric_power() if exponent is INT_MIN
Дата
Msg-id 3160982.1609783162@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Bug in numeric_power() if exponent is INT_MIN  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Список pgsql-hackers
Dean Rasheed <dean.a.rasheed@gmail.com> writes:
> The issue is in this line from power_var_int():
>     sig_digits += (int) log(Abs(exp)) + 8;
> because "exp" is a signed int, so Abs(exp) leaves INT_MIN unchanged.
> The most straightforward fix is to use fabs() instead, so that "exp"
> is cast to double *before* the absolute value is taken, as in the
> attached patch.

Nice catch, and the fix seems appropriate.

            regards, tom lane



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