diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2014-08-25 12:09:32 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2014-10-02 20:57:19 +0200 |
commit | 0f9148ac9b6588dd18bd20d4a04de316cb84c766 (patch) | |
tree | 97799ea8570e542064565dc485cec6cb92e0fba2 /src/gui/painting/qregion.cpp | |
parent | 9af1d11fcf7e0901e1352e5079ebb392155fe73a (diff) |
QRegion: fix a valgrind warning
When:
- i == 0 (at end of current POINTBLOCK),
- numFullPtBlocks == 1 (only one more POINTBLOCK left) and
- iCurPtBlock == 0 (last block contains no points),
Valgrind rightfully complained about an invalid read:
Conditional jump or move depends on uninitialised value(s)
at 0x517B08B: PolygonRegion(QPoint const*, int, int) (qregion.cpp:3480)
Fixed by setting 'next' to nullptr when !numFullPtBlocks OR !iCurPtBlock.
Change-Id: If5225fdfa66f2910a8aafb675cd02b40c0a81ad9
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/gui/painting/qregion.cpp')
-rw-r--r-- | src/gui/painting/qregion.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 6bf5f6bf88..c556edd4c0 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -3472,7 +3472,7 @@ static void PtsToRegion(int numFullPtBlocks, int iCurPtBlock, } if (rowSize) { - QPoint *next = i ? &pts[2] : (numFullPtBlocks ? CurPtBlock->next->pts : 0); + QPoint *next = i ? &pts[2] : (numFullPtBlocks && iCurPtBlock ? CurPtBlock->next->pts : Q_NULLPTR); if (!next || next->y() != pts[0].y()) { flushRow(row.data(), pts[0].y(), rowSize, reg, &lastRow, &extendTo, &needsExtend); |