Skip to content

Commit 23fe661

Browse files
committed
GT-3344: Fixed exception in PeLoader that occurred when creating a
memory block for the headers when the block size exceeded the file size (fixes NationalSecurityAgency#1266).
1 parent ebb336b commit 23fe661

File tree

1 file changed

+1
-1
lines changed
  • Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion

1 file changed

+1
-1
lines changed

Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/PeLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ private Map<SectionHeader, Address> processMemoryBlocks(PortableExecutable pe, P
612612
}
613613

614614
// Header block
615-
int virtualSize = getVirtualSize(pe, sections, space);
615+
int virtualSize = (int) Math.min(getVirtualSize(pe, sections, space), fileBytes.getSize());
616616
long addr = optionalHeader.getImageBase();
617617
Address address = space.getAddress(addr);
618618

0 commit comments

Comments
 (0)