QTextFormat: fix undefined behavior
Left-shifting of negative values is undefined ([expr.shift]/2). Since hashValue is a uint already, rectify by casting it->key to uint prior to shifting. Found by UBSan. Change-Id: I94a5311f5a4492f514f595b8fb79726df1e7d0de Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>bb10
parent
390ea21873
commit
62a96dbb53
|
|
@ -319,7 +319,7 @@ uint QTextFormatPrivate::recalcHash() const
|
|||
{
|
||||
hashValue = 0;
|
||||
for (QVector<Property>::ConstIterator it = props.constBegin(); it != props.constEnd(); ++it)
|
||||
hashValue += (it->key << 16) + variantHash(it->value);
|
||||
hashValue += (static_cast<quint32>(it->key) << 16) + variantHash(it->value);
|
||||
|
||||
hashDirty = false;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue