Skip to content

Fix infinite loop in dash stroker

Albert Astals Cid requested to merge aacid/qtbase:infinite_strokes into kde/5.15

When the positions were large enough, we would get precision errors with the floating point numbers.

We calculate the relative position:

dpos = pos + dashes[istart] - doffset - estart

and then later

pos = dpos + estart

If estart is a huge number (range of 10^18) and dashes[istart] is a low number (10^1), then estart + dashes[istart] == estart and the loop will never progress, dpos will be 0.

Since the loop should never iterate more than dashCount times (since we cut away all full dash sequences before entering it), we add a failsafe that exits the loop if it detects the error.

Fixes: QTBUG-99690

Pick-to: 5.15 6.2 6.3

Change-Id: Ia6a42f21b6b4c6adf5cdd703b6483750513a88ba

Reviewed-by: Lars Knoll lars.knoll@qt.io

(cherry picked from commit 26a06382)

Changed a bit by Albert Astals Cid so it applies to the kde/5.15 branch

Merge request reports