diff options
author | João Abecasis <joao.abecasis@nokia.com> | 2010-08-31 14:52:33 (GMT) |
---|---|---|
committer | João Abecasis <joao.abecasis@nokia.com> | 2010-08-31 16:38:11 (GMT) |
commit | b5bfe694814ff4dccc82cc5ae5c5bee0f7254a47 (patch) | |
tree | 9ed4d2d19c546408accac1766325de34d8815aa8 /src | |
parent | b4230429e1a691643f23cfe8aa354779e94288b0 (diff) | |
download | Qt-b5bfe694814ff4dccc82cc5ae5c5bee0f7254a47.zip Qt-b5bfe694814ff4dccc82cc5ae5c5bee0f7254a47.tar.gz Qt-b5bfe694814ff4dccc82cc5ae5c5bee0f7254a47.tar.bz2 |
QTextEngine::LayoutData::reallocate musn't corrupt memory
... on re-allocation failure. So, let's actually check the returned
pointer and fail, instead of using Q_CHECK_PTR.
Task-number: QT-3785
Reviewed-by: Peter Hartmann
Reviewed-by: Samuel Rødal
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/text/qtextengine.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index c30091e..119217a 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2139,8 +2139,11 @@ bool QTextEngine::LayoutData::reallocate(int totalGlyphs) void **newMem = memory; newMem = (void **)::realloc(memory_on_stack ? 0 : memory, newAllocated*sizeof(void *)); - Q_CHECK_PTR(newMem); - if (memory_on_stack && newMem) + if (!newMem) { + layoutState = LayoutFailed; + return false; + } + if (memory_on_stack) memcpy(newMem, memory, allocated*sizeof(void *)); memory = newMem; memory_on_stack = false; |