Skip to content

Commit 278a6c9

Browse files
committedDec 9, 2015
Fix DoReadMemory for Windows mini dumps.
Differential Revision: http://reviews.llvm.org/D15359 llvm-svn: 255083
1 parent 000bf49 commit 278a6c9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎lldb/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "lldb/Target/StopInfo.h"
3131
#include "lldb/Target/Target.h"
3232
#include "lldb/Target/UnixSignals.h"
33+
#include "lldb/Utility/LLDBAssert.h"
3334
#include "llvm/Support/ConvertUTF.h"
3435
#include "llvm/Support/Format.h"
3536
#include "llvm/Support/raw_ostream.h"
@@ -267,7 +268,9 @@ ProcessWinMiniDump::DoReadMemory(lldb::addr_t addr, void *buf, size_t size, Erro
267268
// There's at least some overlap between the beginning of the desired range
268269
// (addr) and the current range. Figure out where the overlap begins and
269270
// how much overlap there is, then copy it to the destination buffer.
270-
const size_t offset = range.start - addr;
271+
lldbassert(range.start <= addr);
272+
const size_t offset = addr - range.start;
273+
lldbassert(offset < range.size);
271274
const size_t overlap = std::min(size, range.size - offset);
272275
std::memcpy(buf, range.ptr + offset, overlap);
273276
return overlap;

0 commit comments

Comments
 (0)