Re: XLogInsert() of dangling pointer while logging replica identity

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Stas Kelvich <s.kelvich@postgrespro.ru>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2019-02-01T01:38:49Z
Lists: pgsql-hackers
On Thu, Jan 31, 2019 at 11:51:36PM +0300, Stas Kelvich wrote:
>   It seems that heapam.c:3082 calls XLogRegisterData() with an argument
> allocated on stack, but following call to XLogInsert() happens after
> end of context for that variable.
>   Issue spotted by clang's AddressSanitizer. Fix attached.

Oh, good catch.  Committed and back-patched down to 9.4.
--
Michael

Commits

  1. Fix use of dangling pointer in heap_delete() when logging replica identity