summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-07-30 09:27:37 +0300
committerMarc Mutz <marc.mutz@kdab.com>2016-07-31 14:21:38 +0000
commitb37539442f58fc7c0ba54380f07b132a15a037e8 (patch)
treeaf073b862e0eb05fb02b6b9521c77d20ee616f15 /src/widgets/itemviews
parent8740a87841689c97dc92f7600b33c260e4bf7f2c (diff)
QColor: Fix UB (left shift of negative number)
If hex2int(const char*) is called with invalid input, it is expected to return a negative value. However, it didn't check the return value of h2i() before attempting a left-shift on it, leading to UB when the first digit was already invalid. UBSan agrees: qcolor_p.cpp:55:23: runtime error: left shift of negative value -1 This is particularly worrisome as the function can be called with unsanitized input. Fix by checking each value for non-negativity, returning -1 early when errors are detected. Also port to QtMiscUtils::fromHex() and add some docs. Change-Id: I33dbc157ffb4fbfba27113a0a008eef35c1055f7 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/widgets/itemviews')
0 files changed, 0 insertions, 0 deletions