DBG: added boundary checks on DbgMemRead and DbgMemWrite (might solve some unexpected crashes like the ones I experienced today with a random enigma file)
This commit is contained in:
parent
e038d690da
commit
f6adccaef8
|
|
@ -208,6 +208,11 @@ BRIDGE_IMPEXP int BridgeGetDbgVersion()
|
|||
//Debugger
|
||||
BRIDGE_IMPEXP bool DbgMemRead(duint va, unsigned char* dest, duint size)
|
||||
{
|
||||
if(IsBadWritePtr(dest, size))
|
||||
{
|
||||
GuiAddLogMessage("DbgMemRead with invalid boundaries!\n");
|
||||
return false;
|
||||
}
|
||||
bool ret=_dbg_memread(va, dest, size, 0);
|
||||
if(!ret)
|
||||
memset(dest, 0x90, size);
|
||||
|
|
@ -216,6 +221,11 @@ BRIDGE_IMPEXP bool DbgMemRead(duint va, unsigned char* dest, duint size)
|
|||
|
||||
BRIDGE_IMPEXP bool DbgMemWrite(duint va, const unsigned char* src, duint size)
|
||||
{
|
||||
if(IsBadReadPtr(src, size))
|
||||
{
|
||||
GuiAddLogMessage("DbgMemWrite with invalid boundaries!\n");
|
||||
return false;
|
||||
}
|
||||
return _dbg_memwrite(va, src, size, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -927,6 +927,8 @@ int_t Disassembly::getNextInstructionRVA(int_t rva, uint_t count)
|
|||
int_t wMaxByteCountToRead;
|
||||
int_t wNewRVA;
|
||||
|
||||
if(mMemPage->getSize() < rva)
|
||||
return rva;
|
||||
wRemainingBytes = mMemPage->getSize() - rva;
|
||||
|
||||
wMaxByteCountToRead = 16 * (count + 1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue