Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 47412e0

Browse files
committed
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
1 parent cf25498 commit 47412e0

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/backend/access/heap/heapam.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3343,6 +3343,7 @@ heap_delete(Relation relation, ItemPointer tid,
33433343
if (RelationNeedsWAL(relation))
33443344
{
33453345
xl_heap_delete xlrec;
3346+
xl_heap_header xlhdr;
33463347
XLogRecPtr recptr;
33473348

33483349
/* For logical decode we need combocids to properly decode the catalog */
@@ -3377,8 +3378,6 @@ heap_delete(Relation relation, ItemPointer tid,
33773378
*/
33783379
if (old_key_tuple != NULL)
33793380
{
3380-
xl_heap_header xlhdr;
3381-
33823381
xlhdr.t_infomask2 = old_key_tuple->t_data->t_infomask2;
33833382
xlhdr.t_infomask = old_key_tuple->t_data->t_infomask;
33843383
xlhdr.t_hoff = old_key_tuple->t_data->t_hoff;

0 commit comments

Comments
 (0)