mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-10 06:02:09 +00:00
GP-4927: Fixing NeLoader IndexOutOfBoundsException
This commit is contained in:
parent
f292bad0ed
commit
13d36c3c60
@ -350,8 +350,15 @@ public class NeLoader extends AbstractOrdinalSupportLoader {
|
||||
Address addr = space.getAddress(segidx, 0);
|
||||
|
||||
try {
|
||||
int offset = resource.getFileOffsetShifted();
|
||||
int length = resource.getFileLengthShifted();
|
||||
long offset = Integer.toUnsignedLong(resource.getFileOffsetShifted());
|
||||
long length = Integer.toUnsignedLong(resource.getFileLengthShifted());
|
||||
long extra = offset + length - fileBytes.getSize();
|
||||
if (extra > 0) {
|
||||
log.appendMsg(
|
||||
"Resource at 0x%x exceeds file length by 0x%x bytes...truncating"
|
||||
.formatted(offset, extra));
|
||||
length -= extra;
|
||||
}
|
||||
if (length > 0) {
|
||||
MemoryBlockUtils.createInitializedBlock(program, false, "Rsrc" + (id++),
|
||||
addr, fileBytes, offset, length, "", "", true, false, false, log);
|
||||
|
Loading…
Reference in New Issue
Block a user