From a04969affec3486045cfc954bda59d1a3217e319 Mon Sep 17 00:00:00 2001 From: Alexander Golubev Date: Wed, 18 Mar 2026 13:35:30 +0300 Subject: Fix infinite looping in TQTextEngine::shape() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With certain characters a loop inside TQTextEngine::shape() could repeat forever because some script engines were requesting more memory because of a mistake. In particular this were observed with at least letters "ई" (U+0908, DEVANAGARI LETTER II) and "ༀ" (U+0F00, TIBETAN SYLLABLE OM). The problem was already solved in Qt somewhere between last Qt3 release and first Qt4. But due to no public VCS is available it's impossible to pinpoint an exact commit. This patch is heavily based on the Qt-4.3.5 code. Closes: https://mirror.git.trinitydesktop.org/gitea/TDE/tqt/issues/270 Bug: https://mirror.git.trinitydesktop.org/gitea/TDE/tdeutils/issues/93 Signed-off-by: Alexander Golubev --- src/kernel/tqscriptengine.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/kernel/tqscriptengine.cpp') diff --git a/src/kernel/tqscriptengine.cpp b/src/kernel/tqscriptengine.cpp index e9431463c..8c8fbe308 100644 --- a/src/kernel/tqscriptengine.cpp +++ b/src/kernel/tqscriptengine.cpp @@ -434,13 +434,14 @@ static bool hebrew_shape(TQShaperItem *item) if (openType && openType->supportsScript(item->script)) { openType->selectScript(item->script, hebrew_features); + const int availableGlyphs = item->num_glyphs; if (item->font->stringToCMap(item->string->unicode()+item->from, item->length, item->glyphs, item->advances, &item->num_glyphs, item->flags & TQTextEngine::RightToLeft) != TQFontEngine::NoError) return false; heuristicSetGlyphAttributes(item); openType->shape(item); - return openType->positionAndAdd(item); + return openType->positionAndAdd(item, availableGlyphs); } #endif @@ -1580,8 +1581,7 @@ static bool arabicSyriacOpenTypeShape(TQOpenType *openType, TQShaperItem *item, *ot_ok = false; return false; } - item->num_glyphs = nglyphs; - return openType->positionAndAdd(item); + return openType->positionAndAdd(item, nglyphs); } #endif -- cgit v1.2.3