diff options
author | dt <qtc-committer@nokia.com> | 2009-08-28 17:19:42 +0200 |
---|---|---|
committer | con <qtc-committer@nokia.com> | 2009-08-31 10:27:58 +0200 |
commit | fc12d31ac48f3c1fb4b3de41369d3b10dc22ce37 (patch) | |
tree | b1599dc96da1cc31e10e6429e97c36eb2bf5eaaa | |
parent | bca3c66103733281eace7e82fc4c968490202171 (diff) |
Fix allocating potential far too much memory in the debugger.
Beware of negative sizes.
(cherry picked from commit 8a3e02a9e47f4ee3712263aadda936b612461bc5)
-rw-r--r-- | src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp b/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp index e5893d2b36..ee941972cb 100644 --- a/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp +++ b/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp @@ -709,8 +709,9 @@ int CdbSymbolGroupContext::dumpQString(CIDebugDataSpaces *ds, WatchData *wd) if (truncated) size = maxLength; const QChar doubleQuote = QLatin1Char('"'); - QString value(doubleQuote); - if (size) { + QString value; + if (size > 0) { + value += doubleQuote; // Should this ever be a remote debugger, need to check byte order. unsigned short *buf = new unsigned short[size + 1]; unsigned long bytesRead; @@ -724,8 +725,13 @@ int CdbSymbolGroupContext::dumpQString(CIDebugDataSpaces *ds, WatchData *wd) delete [] buf; if (truncated) value += QLatin1String("..."); + value += doubleQuote; + } else if (size == 0) { + value = QString(doubleQuote) + doubleQuote; + } else { + value = "Invalid QString"; } - value += doubleQuote; + wd->setValue(value); wd->setHasChildren(false); return 0; |