DBG: Fix mapped area overrun in ReadDebugDirectory for bogus debugDirSize
This commit is contained in:
parent
0adb663a91
commit
1e9bf1ab7c
|
@ -387,7 +387,11 @@ void ReadDebugDirectory(MODINFO & Info, ULONG_PTR FileMapVA)
|
|||
FALSE,
|
||||
IMAGE_DIRECTORY_ENTRY_DEBUG,
|
||||
&debugDirSize);
|
||||
if(debugDirSize == 0 || debugDir == nullptr)
|
||||
if(debugDirSize == 0 || debugDir == nullptr ||
|
||||
// Check if debugDir fits into the mapped area
|
||||
(ULONG_PTR)debugDir + debugDirSize > FileMapVA + Info.loadedSize ||
|
||||
// Check for ULONG_PTR wraparound (e.g. when debugDirSize == 0xfffff000)
|
||||
(ULONG_PTR)debugDir + debugDirSize < (ULONG_PTR)debugDir)
|
||||
return;
|
||||
|
||||
struct CV_HEADER
|
||||
|
|
Loading…
Reference in New Issue