0001-dlist_check-add-check-for-nodes-pointing-to-themselv.patch

application/octet-stream

Filename: 0001-dlist_check-add-check-for-nodes-pointing-to-themselv.patch
Type: application/octet-stream
Part: 0
Message: dlist_check: add check for nodes pointing to themselves

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch 0001
Subject: dlist_check: add check for nodes pointing to themselves
File+
src/backend/lib/ilist.c 4 2
From 016a2c695a55f32a9df0e77ee9142c86c9a8f70d Mon Sep 17 00:00:00 2001
From: Lei Yang <yanglei@halodbtech.com>
Date: Tue, 17 Mar 2026 20:51:28 +0800
Subject: [PATCH] dlist_check: add check for nodes pointing to themselves

---
 src/backend/lib/ilist.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/backend/lib/ilist.c b/src/backend/lib/ilist.c
index d238858e24f..27dac796fd2 100644
--- a/src/backend/lib/ilist.c
+++ b/src/backend/lib/ilist.c
@@ -91,7 +91,8 @@ dlist_check(const dlist_head *head)
 			cur->next == NULL ||
 			cur->prev == NULL ||
 			cur->prev->next != cur ||
-			cur->next->prev != cur)
+			cur->next->prev != cur ||
+			cur->next == cur)
 			elog(ERROR, "doubly linked list is corrupted");
 	}
 
@@ -102,7 +103,8 @@ dlist_check(const dlist_head *head)
 			cur->next == NULL ||
 			cur->prev == NULL ||
 			cur->prev->next != cur ||
-			cur->next->prev != cur)
+			cur->next->prev != cur ||
+			cur->prev == cur)
 			elog(ERROR, "doubly linked list is corrupted");
 	}
 }
-- 
2.34.1