From: Andrew Gierth <rhodiumtoad@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Repair double-free in SP-GIST rescan (bug #15378)
Date: Tue, 11 Sep 2018 18:58:52 +0000
Message-ID: <E1fznsC-0005il-F2@gemulon.postgresql.org> (raw)
Repair double-free in SP-GIST rescan (bug #15378)
spgrescan would first reset traversalCxt, and then traverse a
potentially non-empty stack containing pointers to traversalValues
which had been allocated in those contexts, freeing them a second
time. This bug originates in commit ccd6eb49a where traversalValue was
introduced.
Repair by traversing the stack before the context reset; this isn't
ideal, since it means doing retail pfree in a context that's about to
be reset, but the freeing of a stack entry is also done in other
places in the code during the scan so it's not worth trying to
refactor it further. Regression test added.
Backpatch to 9.6 where the problem was introduced.
Per bug #15378; analysis and patch by me, originally from a report on
IRC by user velix; see also PostGIS ticket #4174; review by Alexander
Korotkov.
Discussion: https://postgr.es/m/153663176628.23136.11901365223750051490@wrigleys.postgresql.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/500d49794f1f61cb20f485bd5c5052c122e58cf9
Modified Files
--------------
src/backend/access/spgist/spgscan.c | 10 +++++++---
src/test/regress/expected/spgist.out | 18 ++++++++++++++++++
src/test/regress/sql/spgist.sql | 15 +++++++++++++++
3 files changed, 40 insertions(+), 3 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: rhodiumtoad@postgresql.org
Subject: Re: pgsql: Repair double-free in SP-GIST rescan (bug #15378)
In-Reply-To: <E1fznsC-0005il-F2@gemulon.postgresql.org>
References: <E1fznsC-0005il-F2@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox