From 08c57f1d3b6f6fee02482485e663bca953e23480 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Thu, 6 Aug 2015 17:26:13 -0400 Subject: [PATCH] Debugger: Fix #12291. UiUtils: - Fix incorrect check to see if we had hit the bounds of the current memory block that would cause us to overflow the block's data buffer if incorrect length values were passed in. --- src/apps/debugger/user_interface/util/UiUtils.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/apps/debugger/user_interface/util/UiUtils.cpp b/src/apps/debugger/user_interface/util/UiUtils.cpp index b1d326eb13..064d85c614 100644 --- a/src/apps/debugger/user_interface/util/UiUtils.cpp +++ b/src/apps/debugger/user_interface/util/UiUtils.cpp @@ -337,6 +337,9 @@ UiUtils::DumpMemory(BString& _output, int32 indentLevel, int32 j; _output.Append('\t', indentLevel); for (int32 i = 0; i < count; i++) { + if (!block->Contains(address + i * itemSize)) + break; + uint8* value; if ((i % displayWidth) == 0) { @@ -350,8 +353,6 @@ UiUtils::DumpMemory(BString& _output, int32 indentLevel, _output += data; char c; for (j = 0; j < displayed; j++) { - if (!block->Contains(address + displayed)) - break; c = *(block->Data() + address - block->BaseAddress() + (i * itemSize) + j); if (!isprint(c))