Re: [HACKERS] Fix freeing of dangling IndexScanDesc.xs_hitup in GiST - Mailing list pgsql-hackers

From Nikita Glukhov
Subject Re: [HACKERS] Fix freeing of dangling IndexScanDesc.xs_hitup in GiST
Date
Msg-id 05923dca-11d6-a59c-d22b-30f020bf367d@postgrespro.ru
Whole thread Raw
In response to Re: [HACKERS] Fix freeing of dangling IndexScanDesc.xs_hitup in GiST  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 04.05.2017 22:16, Tom Lane wrote:

> Nikita Glukhov <n.gluhov@postgrespro.ru> writes:
>> In gistrescan() IndexScanDesc.xs_hitup is not reset after MemoryContextReset() of
>> so->queueCxt in which xs_hitup was allocated, then getNextNearest() tries to pfree()
>> dangling xs_hitup, which results in the reuse of this pointer and the subsequent crash.
> Right.  I already did something about this, about an hour ago --- a
> bit differently from your patch, but same idea.
>
>             regards, tom lane

Sorry that I'm not monitoring pgsql-bugs.

It might be interesting that I found this bug back in July 2016 when I
was experimenting with my KNN-btree implementation, but I failed to report
it because I could reproduce it only manually by a calling in a loop
gistrescan() and gistgettuple().

-- 
Nikita Glukhov
Postgres Professional:http://www.postgrespro.com
The Russian Postgres Company




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Potential issue with alter system
Next
From: Robert Haas
Date:
Subject: [HACKERS] what's up with IDENTIFIER_LOOKUP_EXPR?