Re: PostgreSQL crashes with SIGSEGV

Aleksandr Parfenov <a.parfenov@postgrespro.ru>

From: Aleksandr Parfenov <a.parfenov@postgrespro.ru>
To: pgsql-hackers@lists.postgresql.org
Cc: Peter Geoghegan <pg@bowt.ie>
Date: 2018-01-16T07:52:26Z
Lists: pgsql-bugs, pgsql-hackers
The following review has been posted through the commitfest application:
make installcheck-world:  tested, passed
Implements feature:       tested, passed
Spec compliant:           tested, passed
Documentation:            tested, passed

Hi,

All information is related to WIP-tuplesort-memcontext-fix.patch.
The patch applies and fixes the bug on REL9_6_STABLE and LGTM.

However, REL9_5_STABLE affected as well and the patch doesn't applicable to it.
But it may be another entry because the difference in tuplesort may cause some changes in the fix too.

The new status of this patch is: Ready for Committer

Commits

  1. Fix actual and potential double-frees around tuplesort usage.

  2. Allow the built-in ordered-set aggregates to share transition state.

  3. Avoid integer overflow while sifting-up a heap in tuplesort.c.

  4. Allow avoiding tuple copy within tuplesort_gettupleslot().

  5. Remove should_free arguments to tuplesort routines.

  6. Fix use-after-free around DISTINCT transition function calls.

  7. Reuse abbreviated keys in ordered [set] aggregates.