Re: Negative value of numGroups

Andrei Lepikhov <a.lepikhov@postgrespro.ru>

From: Andrey Lepikhov <a.lepikhov@postgrespro.ru>
To: pgsql-bugs@lists.postgresql.org
Date: 2022-05-17T12:59:23Z
Lists: pgsql-bugs

Attachments

On 13/5/2022 11:56, Andrey Lepikhov wrote:
> (long) Min(numGroups, (double) LONG_MAX);
> 
> can return negative value, if numGroups > LONG_MAX.
So, because this problem still breaks sqlancer tests I prepared a patch 
(with regression test) that fixes it.

-- 
regards,
Andrey Lepikhov
Postgres Professional

Commits

  1. Avoid overflow hazard when clamping group counts to "long int".