forked from qt-creator/qt-creator
Fix allocating potential far too much memory in the debugger.
Beware of negative sizes.
This commit is contained in:
@@ -709,8 +709,9 @@ int CdbSymbolGroupContext::dumpQString(CIDebugDataSpaces *ds, WatchData *wd)
|
|||||||
if (truncated)
|
if (truncated)
|
||||||
size = maxLength;
|
size = maxLength;
|
||||||
const QChar doubleQuote = QLatin1Char('"');
|
const QChar doubleQuote = QLatin1Char('"');
|
||||||
QString value(doubleQuote);
|
QString value;
|
||||||
if (size) {
|
if (size > 0) {
|
||||||
|
value += doubleQuote;
|
||||||
// Should this ever be a remote debugger, need to check byte order.
|
// Should this ever be a remote debugger, need to check byte order.
|
||||||
unsigned short *buf = new unsigned short[size + 1];
|
unsigned short *buf = new unsigned short[size + 1];
|
||||||
unsigned long bytesRead;
|
unsigned long bytesRead;
|
||||||
@@ -724,8 +725,13 @@ int CdbSymbolGroupContext::dumpQString(CIDebugDataSpaces *ds, WatchData *wd)
|
|||||||
delete [] buf;
|
delete [] buf;
|
||||||
if (truncated)
|
if (truncated)
|
||||||
value += QLatin1String("...");
|
value += QLatin1String("...");
|
||||||
|
value += doubleQuote;
|
||||||
|
} else if (size == 0) {
|
||||||
|
value = QString(doubleQuote) + doubleQuote;
|
||||||
|
} else {
|
||||||
|
value = "Invalid QString";
|
||||||
}
|
}
|
||||||
value += doubleQuote;
|
|
||||||
wd->setValue(value);
|
wd->setValue(value);
|
||||||
wd->setHasChildren(false);
|
wd->setHasChildren(false);
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user