v1-0001-Zero-pad-bytes-of-xl_running_xacts.patch

application/octet-stream

Filename: v1-0001-Zero-pad-bytes-of-xl_running_xacts.patch
Type: application/octet-stream
Part: 0
Message: Fix uninitialized xl_running_xacts padding

Patch

Format: format-patch
Series: patch v1-0001
Subject: Zero pad bytes of xl_running_xacts
File+
src/backend/storage/ipc/standby.c 1 0
From 555b1ddf4daa983a539a1ef0461bffe15f8d5711 Mon Sep 17 00:00:00 2001
From: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Date: Fri, 13 Feb 2026 09:22:45 +0100
Subject: Zero pad bytes of xl_running_xacts

xl_running_xacts has 3 padding bytes after subxid_overflow which are
currently uninitialized. When the struct is written, those uninitialized
bytes are also written in the WAL.

This patch ensures those pad bytes are zeroed.
---
 src/backend/storage/ipc/standby.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/backend/storage/ipc/standby.c b/src/backend/storage/ipc/standby.c
index 7fa8d9247e0..4db944c3a16 100644
--- a/src/backend/storage/ipc/standby.c
+++ b/src/backend/storage/ipc/standby.c
@@ -1355,6 +1355,7 @@ LogCurrentRunningXacts(RunningTransactions CurrRunningXacts)
 	xl_running_xacts xlrec;
 	XLogRecPtr	recptr;
 
+	MemSet(&xlrec, 0, sizeof(xl_running_xacts));
 	xlrec.xcnt = CurrRunningXacts->xcnt;
 	xlrec.subxcnt = CurrRunningXacts->subxcnt;
 	xlrec.subxid_overflow = (CurrRunningXacts->subxid_status != SUBXIDS_IN_ARRAY);
-- 
2.52.0