Make sure lastOffset <= fileData.Length (could be a bad dump)

This commit is contained in:
de4dot 2012-12-13 16:19:34 +01:00
parent bf7c0d58d2
commit 7bcf5b4710

View File

@ -199,7 +199,7 @@ namespace de4dot.code.deobfuscators.CodeVeil {
const int RVA_EXECUTIVE_OFFSET = 1 * 4;
const int ENC_CODE_OFFSET = 6 * 4;
int lastOffset = (int)(section.PointerToRawData + section.SizeOfRawData);
int lastOffset = Math.Min(fileData.Length, (int)(section.PointerToRawData + section.SizeOfRawData));
for (int offset = getStartOffset(peImage); offset < lastOffset; ) {
offset = findSig(fileData, offset, lastOffset, initializeMethodEnd);
if (offset < 0)