Skip to content

Ghidra is a software reverse engineering (SRE) framework

Merge branch 'GT-0_ghidra1_PR-2136_TheBitshifter_ElfNoBitsSize'

ghidra1aac0c2229f29
diff --cc Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/ElfProgramBuilder.java
index 79c4024c68,53d99f24ad..563d0137b9
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/ElfProgramBuilder.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/ElfProgramBuilder.java
@@@ -2702,7 -2702,7 +2702,8 @@@ class ElfProgramBuilder extends MemoryS
ElfSectionHeader[] sections = elf.getSections();
for (ElfSectionHeader elfSectionToLoad : sections) {
monitor.checkCanceled();
-- if (elfSectionToLoad.getType() != ElfSectionHeaderConstants.SHN_UNDEF &&
++ int type = elfSectionToLoad.getType();
++ if (type != ElfSectionHeaderConstants.SHN_UNDEF &&
(includeOtherBlocks || elfSectionToLoad.isAlloc())) {
long fileOffset = elfSectionToLoad.getOffset();
if (fileOffset < 0 || fileOffset >= fileBytes.getSize()) {
@@@ -2711,7 -2711,7 +2712,8 @@@
continue;
}
long size = elfSectionToLoad.getSize();
- if (size <= 0 || size >= fileBytes.getSize()) {
- if (size <= 0 || (elfSectionToLoad.getType() != ElfSectionHeaderConstants.SHT_NOBITS && size >= fileBytes.getSize())) {
++ if (size <= 0 ||
++ (type != ElfSectionHeaderConstants.SHT_NOBITS && size >= fileBytes.getSize())) {
log("Skipping section [" + elfSectionToLoad.getNameAsString() +
"] with invalid size");
continue;