Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
4.8.0
-
None
-
All
-
74e777a76b9ac63107a32422c28ad79cd2217250
Description
Look at this code
if (clusterLength) { const QGlyphLayout &glyphs = shapedGlyphs(si); QFixed glyphWidth = glyphs.effectiveAdvance(glyph_pos); // the approximate width of each individual element of the ligature QFixed perItemWidth = glyphWidth / clusterLength; QFixed left = x > edge ? edge : edge - glyphWidth; int n = ((x - left) / perItemWidth).floor().toInt(); QFixed dist = x - left - n * perItemWidth; int closestItem = dist > (perItemWidth / 2) ? n + 1 : n; if (cursorOnCharacter && closestItem > 0) closestItem--; int pos = si->position + clusterStart + closestItem; // Jump to the next charStop while (!attrs[pos].charStop && pos < end) pos++; return pos; }
If "glyphWidth==0" then "perItemWidth=0" and we have divizion by zero in "n" calculation.
I got segfault error and had found this division by zero. I think this is the cause.