Skip to content

Commit

Permalink
Fix infinite loop in HorizontalTextLayouter if there's not enough spa…
Browse files Browse the repository at this point in the history
…ce 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)
  • Loading branch information
tsdgeos committed Dec 29, 2023
1 parent 8a9f1d3 commit f1c6996
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion poppler/Annot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f1c6996

Please sign in to comment.