mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-22 22:28:00 +08:00
GT-3241: Better handling of stripped ELF section headers (fixes #1119).
This commit is contained in:
@@ -159,8 +159,14 @@ public class ElfHeader implements StructConverter, Writeable {
|
||||
e_ehsize = reader.readNextShort();
|
||||
e_phentsize = reader.readNextShort();
|
||||
e_phnum = reader.readNextShort();
|
||||
if (e_phnum < 0) {
|
||||
e_phnum = 0; // protect against stripped program headers
|
||||
}
|
||||
e_shentsize = reader.readNextShort();
|
||||
e_shnum = reader.readNextShort();
|
||||
if (e_shnum < 0) {
|
||||
e_shnum = 0; // protect against stripped section headers (have seen -1)
|
||||
}
|
||||
e_shstrndx = reader.readNextShort();
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
||||
Reference in New Issue
Block a user