From 9ef07b0176dcea862d59a66f7be8bb1467550356 Mon Sep 17 00:00:00 2001 From: Fred Natzke Date: Tue, 6 Dec 2022 16:29:09 +1000 Subject: [PATCH] Fix Issue 519 Break infinite loop parsing kid token list containing parent --- src/UglyToad.PdfPig/Parser/CatalogFactory.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/UglyToad.PdfPig/Parser/CatalogFactory.cs b/src/UglyToad.PdfPig/Parser/CatalogFactory.cs index da2bb2cc..dd31ae59 100644 --- a/src/UglyToad.PdfPig/Parser/CatalogFactory.cs +++ b/src/UglyToad.PdfPig/Parser/CatalogFactory.cs @@ -102,8 +102,8 @@ do { - var current = toProcess.Dequeue(); - + var current = toProcess.Dequeue(); + if (current.reference.GetHashCode() == current.parentReference.GetHashCode()) { continue; } // Issue #519 if (!current.nodeDictionary.TryGet(NameToken.Kids, pdfTokenScanner, out ArrayToken kids)) { if (!isLenientParsing)