From f1c69969e031687e6d991677dda021a2a4db48e3 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Fri, 29 Dec 2023 17:29:56 +0100 Subject: [PATCH] Fix infinite loop in HorizontalTextLayouter if there's not enough space to layout text #2 Happens only if the first chracter we're asking to draw can't be drawn with the given font and we need to find a new one and the given available space is negative (as said this function must always layout at least one character) --- poppler/Annot.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poppler/Annot.cc b/poppler/Annot.cc index b4c4a7710..e8db39ff3 100644 --- a/poppler/Annot.cc +++ b/poppler/Annot.cc @@ -3036,7 +3036,7 @@ class HorizontalTextLayouter *availableWidth -= blockWidth; } - while (newFontNeeded && (!availableWidth || *availableWidth > 0)) { + while (newFontNeeded && (!availableWidth || *availableWidth > 0 || (isUnicode && i == 2) || (!isUnicode && i == 0))) { if (!form) { // There's no fonts to look for, so just skip the characters i += isUnicode ? 2 : 1;