From 4f431cc6a38b025734694864f4af5dd8ea12dd10 Mon Sep 17 00:00:00 2001 From: Reini Urban Date: Sun, 6 Feb 2022 20:01:21 +0100 Subject: [PATCH] dwg_next_entity: fix immediate cycles but we cannot yet detect non-immediate cycles, as from illegal, fuzzed DWGs. See GH #345 --- src/dwg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dwg.c b/src/dwg.c index a6a959adf3..a010085d34 100644 --- a/src/dwg.c +++ b/src/dwg.c @@ -1095,7 +1095,10 @@ dwg_next_entity (const Dwg_Object *restrict obj) goto next_obj; next = obj->tio.entity->next_entity; if (next && next->absolute_ref) - return dwg_ref_object_silent (obj->parent, next); + { + Dwg_Object *next_obj = dwg_ref_object_silent (obj->parent, next); + return (obj == next_obj) ? NULL : next_obj; + } else goto next_obj; }