forked from qt-creator/qt-creator
reformatCharacter: int to QChar conversion segfault
Debugger, watchhandler: incorrect type conversion: Converting from `int` to `unsigned int` can lead to a situation where the result is too large to be represented as a `QChar`. Task-number: QTCREATORBUG-27107 Change-Id: I7873635f7a1ef29f62339ffe23b4dd84cb089e2b Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -663,7 +663,14 @@ static QString reformatInteger(quint64 value, int format, int size, bool isSigne
|
||||
// Format printable (char-type) characters
|
||||
static QString reformatCharacter(int code, int size, bool isSigned)
|
||||
{
|
||||
const QChar c = QChar(uint(code));
|
||||
QChar c;
|
||||
switch (size) {
|
||||
case 1: c = QChar(uchar(code)); break;
|
||||
case 2: c = QChar(uint16_t(code)); break;
|
||||
case 4: c = QChar(uint32_t(code)); break;
|
||||
default: c = QChar(uint(code)); break;
|
||||
}
|
||||
|
||||
QString out;
|
||||
if (c.isPrint())
|
||||
out = QString("'") + c + "' ";
|
||||
|
||||
Reference in New Issue
Block a user