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

Michael Paquier <michael@paquier.xyz>

Commit: 05d24cf7ca7aae4f6842dfbd0962a9d04511ba78
Author: Michael Paquier <michael@paquier.xyz>
Date: 2019-02-01T01:36:02Z
Releases: 9.4.21
Fix use of dangling pointer in heap_delete() when logging replica identity

When logging the replica identity of a deleted tuple, XLOG_HEAP_DELETE
records include references of the old tuple.  Its data is stored in an
intermediate variable used to register this information for the WAL
record, but this variable gets away from the stack when the record gets
actually inserted.

Spotted by clang's AddressSanitizer.

Author: Stas Kelvish
Discussion: https://postgr.es/m/085C8825-AD86-4E93-AF80-E26CDF03D1EA@postgrespro.ru
Backpatch-through: 9.4

Files

PathChange+/−
src/backend/access/heap/heapam.c modified +1 −2

Discussion