diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-02-22 13:44:58 (GMT) |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2011-02-22 13:54:12 (GMT) |
commit | 9d019830169289a3aa00e8baca9c320963904993 (patch) | |
tree | 03e2a689b96cca552037bc88411410c0e8e7e5b4 /src | |
parent | db9925a187a9ad395ba2cabf23487b9a0e09c67c (diff) | |
download | Qt-9d019830169289a3aa00e8baca9c320963904993.zip Qt-9d019830169289a3aa00e8baca9c320963904993.tar.gz Qt-9d019830169289a3aa00e8baca9c320963904993.tar.bz2 |
Prevent infinite loop in raster engine on zero dash pattern length.
Task-number: QTBUG-17053
Reviewed-by: Kim
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 682731a..ba618ea 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3706,6 +3706,13 @@ void QRasterPaintEnginePrivate::rasterizeLine_dashed(QLineF line, const bool squareCap = (pen.capStyle() == Qt::SquareCap); const QVector<qreal> pattern = pen.dashPattern(); + qreal patternLength = 0; + for (int i = 0; i < pattern.size(); ++i) + patternLength += pattern.at(i); + + if (patternLength <= 0) + return; + qreal length = line.length(); Q_ASSERT(length > 0); while (length > 0) { |