TQTextEngine::shape() hangs up on some characters
## Basic information
- TDE version: R14.2.0 (master)
- Distribution: Gentoo
- Hardware: amd64
## Description
[`TQTextEngine::shape()`](https://mirror.git.trinitydesktop.org/gitea/TDE/tqt/src/commit/6ec5d7ec4ff7cfbb52866b28c8b36e5ea3ee31d1/src/kernel/tqtextengine_unix.cpp#L98) hangs up on some characters in particular `ई (U+0908) DEVANAGARI LETTER II`. This is likely a cause for https://mirror.git.trinitydesktop.org/gitea/TDE/tdeutils/issues/93 .
## Steps to reproduce
1. Build:
```cpp
// Build with g++ $(pkg-config --cflags --libs tqt-mt) foo.cpp
#include <tqapplication.h>
#include <tqlabel.h>
int main(int argc, char *argv[])
{
const unsigned char devanagari_letter_ii_u8[] = {0xE0, 0xA4, 0x88, 0x00};
TQApplication app(argc, argv);
TQLabel l(TQString::fromUtf8((const char*)devanagari_letter_ii_u8), 0);
app.setMainWidget(&l);
l.show();
return app.exec();
}
```
2. Run it
3. It hangs up
## Screenshots
<details>
<summary>(gdb) bt</summary>
```d
#0 0x00007ffff70b4e58 in __memmove_sse2_unaligned_erms () from /lib64/libc.so.6
#1 0x00007ffff78fb497 in memcpy (__dest=0x555555796378, __src=<optimized out>, __len=<optimized out>) at /usr/include/bits/string_fortified.h:29
#2 TQTextEngine::reallocate (this=0x5555556302b0, totalGlyphs=297872) at kernel/tqtextengine.cpp:949
#3 0x00007ffff78fc281 in TQTextEngine::ensureSpace (this=this@entry=0x5555556302b0, nGlyphs=<optimized out>) at kernel/tqtextengine_p.h:332
#4 0x00007ffff78fb6ca in TQTextEngine::shape (this=0x5555556302b0, item=0) at kernel/tqtextengine_unix.cpp:99
#5 0x00007ffff78f92b5 in TQTextLayout::currentItem (this=this@entry=0x7fffffffc698) at kernel/tqtextlayout.cpp:324
#6 0x00007ffff788c5fa in qt_format_text (font=..., _r=..., tf=134226497, str="ई", len=len@entry=1, brect=brect@entry=0x7fffffffc810, tabstops=64, tabarray=0x0, tabarraylen=0, painter=0x0) at kernel/tqpainter.cpp:2893
#7 0x00007ffff7850f21 in TQFontMetrics::boundingRect (this=this@entry=0x7fffffffc8e0, x=x@entry=0, y=y@entry=0, w=w@entry=2000, h=h@entry=2000, flgs=<optimized out>, str="ई", len=1, tabstops=0, tabarray=0x0, intern=0x0)
at kernel/tqfont.cpp:2480
#8 0x00007ffff7932b8e in TQLabel::sizeForWidth (this=this@entry=0x7fffffffcaf0, w=2000, w@entry=-1) at widgets/tqlabel.h:84
#9 0x00007ffff7932dd7 in TQLabel::minimumSizeHint (this=0x7fffffffcaf0) at widgets/tqlabel.cpp:641
#10 0x00007ffff7932ef9 in TQLabel::sizeHint (this=0x7fffffffcaf0) at widgets/tqlabel.cpp:626
#11 0x00007ffff7931bc2 in TQLabel::updateLabel (this=this@entry=0x7fffffffcaf0, oldSizeHint=oldSizeHint@entry=...) at widgets/tqlabel.cpp:863
#12 0x00007ffff793243d in TQLabel::setText (this=this@entry=0x7fffffffcaf0, text="ई") at widgets/tqlabel.cpp:316
#13 0x00007ffff79325a9 in TQLabel::TQLabel (this=0x7fffffffcaf0, text="ई", parent=<optimized out>, name=<optimized out>, f=<optimized out>) at widgets/tqlabel.cpp:175
#14 0x00005555555552fd in main (argc=1, argv=0x7fffffffcd78) at label.cpp:8
```
</details>
<details>
<summary>(gdb) bt full</summary>
```d
#0 0x00007ffff70b4e58 in __memmove_sse2_unaligned_erms () from /lib64/libc.so.6
No symbol table info available.
#1 0x00007ffff78fb497 in memcpy (__dest=0x555555796378, __src=<optimized out>, __len=<optimized out>) at /usr/include/bits/string_fortified.h:29
No locals.
#2 TQTextEngine::reallocate (this=0x5555556302b0, totalGlyphs=297872) at kernel/tqtextengine.cpp:949
new_num_glyphs = 297872
space_charAttributes = 1
space_logClusters = 1
space_glyphs = 148936
space_advances = 148936
space_offsets = 148936
space_glyphAttributes = 74468
newAllocated = 521278
newMemory = 0x555555796370
nm = 0x555555796378
#3 0x00007ffff78fc281 in TQTextEngine::ensureSpace (this=this@entry=0x5555556302b0, nGlyphs=<optimized out>) at kernel/tqtextengine_p.h:332
No locals.
#4 0x00007ffff78fb6ca in TQTextEngine::shape (this=0x5555556302b0, item=0) at kernel/tqtextengine_unix.cpp:99
shaper_item = {script = 13, string = 0x5555556302b8, from = 0, length = 1, font = 0x5555556a7a20, glyphs = 0x7ffff4a65020, advances = 0x7ffff4b87e20, offsets = 0x7ffff4caac20, attributes = 0x7ffff4dcda20, num_glyphs = 297858,
log_clusters = 0x7ffff4a65018, flags = 0, has_positioning = false}
__PRETTY_FUNCTION__ = "void TQTextEngine::shape(int) const"
si = @0x5555555d8ed8: {position = 0, analysis = {script = 13, bidiLevel = 0, override = 0, reserved = 0}, isSpace = 0, isTab = 0, isObject = 0, hasPositioning = 0, complex = 0, private_use = 0, reserved = 0, descent = 5,
ascent = 12, width = -1, x = 0, y = 0, num_glyphs = 0, glyph_data_offset = 0, fontEngine = 0x5555556a7a20}
script = <optimized out>
advances = <optimized out>
end = <optimized out>
#5 0x00007ffff78f92b5 in TQTextLayout::currentItem (this=this@entry=0x7fffffffc698) at kernel/tqtextlayout.cpp:324
No locals.
#6 0x00007ffff788c5fa in qt_format_text (font=..., _r=..., tf=134226497, str="ई", len=len@entry=1, brect=brect@entry=0x7fffffffc810, tabstops=64, tabarray=0x0, tabarraylen=0, painter=0x0) at kernel/tqpainter.cpp:2893
ti = {item = 1432420472, engine = 0x0}
ascent = 0
linesep = false
descent = 0
lineLeft = 2312
lineRight = 1432420472
lineWidth = <optimized out>
leading = 1
asc = 13
desc = 3
r = {x1 = 0, y1 = 0, x2 = 1999, y2 = 1999}
dontclip = false
wordbreak = <optimized out>
singleline = <optimized out>
showprefix = <optimized out>
noaccel = false
isRightToLeft = <optimized out>
expandtabs = true
maxUnderlines = <optimized out>
numUnderlines = 0
underlinePositionStack = {0, 0, 1999, 1999, 1432420472, 21845, 1431758496, 21845, 1432584064, 21845, 0, 0, 56, 21845, -14192, 32767, 91, 0, 1432602432, 21845, 0, 0, 1, 0, -14192, 32767, -142484349, 32767, 1432590704, 21845,
-14224, 32767}
underlinePositions = 0x7fffffffc6f0
fnt = {d = 0x5555556658d0}
fm = {d = 0x5555556658d0, painter = 0x0, fscript = 56}
text = "ई"
chr = <optimized out>
end = <optimized out>
haveLineSep = <optimized out>
height = 0
left = 2000
right = 0
textLayout = {d = 0x5555556302b0}
rb = 2
lb = 1
yoff = <optimized out>
#7 0x00007ffff7850f21 in TQFontMetrics::boundingRect (this=this@entry=0x7fffffffc8e0, x=x@entry=0, y=y@entry=0, w=w@entry=2000, h=h@entry=2000, flgs=<optimized out>, str="ई", len=1, tabstops=0, tabarray=0x0, intern=0x0)
at kernel/tqfont.cpp:2480
tabarraylen = 0
rb = {x1 = 0, y1 = 0, x2 = -1, y2 = -1}
r = {x1 = 0, y1 = 0, x2 = 1999, y2 = 1999}
--Type <RET> for more, q to quit, c to continue without paging--
#8 0x00007ffff7932b8e in TQLabel::sizeForWidth (this=this@entry=0x7fffffffcaf0, w=2000, w@entry=-1) at widgets/tqlabel.h:84
tryWidth = <optimized out>
br = <optimized out>
pix = 0x0
pic = <optimized out>
mov = <optimized out>
hextra = 0
vextra = 0
fm = {d = 0x55555557bcc0, painter = 0x0, fscript = 56}
xw = 8
wid = <optimized out>
hei = <optimized out>
#9 0x00007ffff7932dd7 in TQLabel::minimumSizeHint (this=0x7fffffffcaf0) at widgets/tqlabel.cpp:641
sz = <optimized out>
#10 0x00007ffff7932ef9 in TQLabel::sizeHint (this=0x7fffffffcaf0) at widgets/tqlabel.cpp:626
No locals.
#11 0x00007ffff7931bc2 in TQLabel::updateLabel (this=this@entry=0x7fffffffcaf0, oldSizeHint=oldSizeHint@entry=...) at widgets/tqlabel.cpp:863
policy = <optimized out>
wordBreak = <optimized out>
#12 0x00007ffff793243d in TQLabel::setText (this=this@entry=0x7fffffffcaf0, text="ई") at widgets/tqlabel.cpp:316
osh = {wd = 3, ht = 17}
hadRichtext = false
useRichText = <optimized out>
#13 0x00007ffff79325a9 in TQLabel::TQLabel (this=0x7fffffffcaf0, text="ई", parent=<optimized out>, name=<optimized out>, f=<optimized out>) at widgets/tqlabel.cpp:175
No locals.
#14 0x00005555555552fd in main (argc=1, argv=0x7fffffffcd78) at label.cpp:8
devanagari_letter_ii_u8 = "ई"
app = {<TQObject> = {<TQt> = {<No data fields>}, _vptr.TQObject = 0x7ffff7d33f08 <vtable for TQApplication+16>, static metaObj = 0x55555556c970, isSignal = 0, isWidget = 0, pendTimer = 0, blockSig = 0, wasDeleted = 0,
isTree = 1, objname = 0x555555601d20 "a.out", parentObj = 0x0, childObjects = 0x555555601840, connections = 0x0, senderObjects = 0x0, eventFilters = 0x0, postedEvents = 0x555555601920, d = 0x5555555727f0},
static metaObj = 0x55555562c5a0, app_argc = 1, app_argv = 0x7fffffffcd78, quit_now = false, quit_code = 0, translators = 0x0, session_manager = 0x55555560f640, session_id = "10d0dd626c000177377907100000035851546",
is_session_restored = false}
l = {<TQFrame> = {<TQWidget> = {<TQObject> = {<TQt> = {<No data fields>}, _vptr.TQObject = 0x7ffff7d40188 <vtable for TQLabel+16>, static metaObj = 0x55555556c970, isSignal = 0, isWidget = 1, pendTimer = 0, blockSig = 0,
wasDeleted = 0, isTree = 1, objname = 0x0, parentObj = 0x0, childObjects = 0x0, connections = 0x0, senderObjects = 0x0, eventFilters = 0x0, postedEvents = 0x555555614140, d = 0x555555610c50}, <TQPaintDevice> = {
_vptr.TQPaintDevice = 0x7ffff7d40598 <vtable for TQLabel+1056>, hd = 94371842, rendhd = 93824992997728, devFlags = 1, painters = 0, static x_appdisplay = 0x555555579920, static x_appscreen = 0, static x_appdepth = 24,
static x_appcells = 256, static x_approotwindow = 886, static x_appcolormap = 32, static x_appdefcolormap = true, static x_appvisual = 0x5555555869e0, static x_appdefvisual = true,
static x_appdepth_arr = 0x555555576610, static x_appcells_arr = 0x555555579850, static x_approotwindow_arr = 0x555555573b70, static x_appcolormap_arr = 0x555555579830, static x_appdefcolormap_arr = 0x555555589a30,
static x_appvisual_arr = 0x555555589a50, static x_appdefvisual_arr = 0x555555589a70, x11Data = 0x0}, static metaObj = 0x555555613a60, winid = 94371842, widget_state = 401433, widget_flags = 2099105, netwm_flags = 0,
reserved_1 = 32767, reserved_2 = 0, reserved_3 = 0, reserved_4 = 1431752816, focus_policy = 0, own_font = 0, own_palette = 0, sizehint_forced = 0, is_closing = 0, fstrut_dirty = 1, im_enabled = 0, crect = {x1 = 480,
y1 = 360, x2 = 1439, y2 = 839}, bg_col = {d = {argb = 4292664559, d8 = {argb = 4292664559, pix = 239 '\357', invalid = 220 '\334', dirty = 220 '\334', direct = 255 '\377'}, d32 = {argb = 4292664559,
pix = 4292664559}}}, pal = {data = 0x555555601ea0}, fnt = {d = 0x55555557bcc0}, lay_out = 0x0, extra = 0x5555556139f0}, static metaObj = 0x555555613870, frect = {x1 = 0, y1 = 0, x2 = -1, y2 = -1}, fstyle = 16,
lwidth = 1, mwidth = 0, mlwidth = 0, fwidth = 0, d = 0x570}, static metaObj = 0x5555556138e0, ltext = "ई", lpixmap = 0x0, lpicture = 0x0, lmovie = 0x0, lbuddy = 0x0, align = 576, extraMargin = -1, autoresize = 0,
scaledcontents = 0, textformat = TQt::AutoText, doc = 0x0, accel = 0x0, d = 0x555555613820}
```
</details>