Re: [BUGS] BUG #14722: Segfault in tuplesort_heap_siftup, 32 bit overflow - Mailing list pgsql-bugs

From Peter Geoghegan
Subject Re: [BUGS] BUG #14722: Segfault in tuplesort_heap_siftup, 32 bit overflow
Date
Msg-id CAH2-WzkqvpkJ6LYHaaZVUS_MwXsHBTOOEHdBE_hwQxzUqvoGbQ@mail.gmail.com
Whole thread Raw
In response to Re: [BUGS] BUG #14722: Segfault in tuplesort_heap_siftup, 32 bitoverflow  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: [BUGS] BUG #14722: Segfault in tuplesort_heap_siftup, 32 bitoverflow
List pgsql-bugs
On Wed, Jul 12, 2017 at 6:15 AM, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
> Another option to use "unsigned int", on the assumption that UINT_MAX >=
> INT_MAX * 2 + 1. And to eliminate that assumption, we can use (UINT_MAX - 1)
> / 2 as the maximum size of the memtuples array, rather than INT_MAX.

FWIW, memtupcount is allowed to go negative. It just won't in this
function, per the assertion. So the fix should be specifically scoped
to only the one function that is affected. That's a good idea anyway,
of course.


-- 
Peter Geoghegan


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: [BUGS] BUG #14722: Segfault in tuplesort_heap_siftup, 32 bit overflow
Next
From: Heikki Linnakangas
Date:
Subject: Re: [BUGS] BUG #14722: Segfault in tuplesort_heap_siftup, 32 bitoverflow