elf: elf64_load_section(): Return false early if sh_num == 0
This commit is contained in:
parent
27a32e416c
commit
573d0095bf
|
@ -297,6 +297,10 @@ bool elf64_load_section(uint8_t *elf, void *buffer, const char *name, size_t lim
|
||||||
#error Unknown architecture
|
#error Unknown architecture
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (hdr->sh_num == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (hdr->shdr_size < sizeof(struct elf64_shdr)) {
|
if (hdr->shdr_size < sizeof(struct elf64_shdr)) {
|
||||||
panic(true, "elf: shdr_size < sizeof(struct elf64_shdr)");
|
panic(true, "elf: shdr_size < sizeof(struct elf64_shdr)");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue