blob: e82524507b8d76da601eabacac18a6f438978318 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
Maybe a mistake in ELF parser
I know it
```c++
https://github.com/ptitSeb/box64/blob/main/src/elfs/elfparser.c#L125
elfheader_t *h = box_calloc(1, sizeof(elfheader_t));
// ...
h->numSHEntries = header.e_shnum;
// ...
if(header.e_shentsize && header.e_shnum) {
// special cases for nums
if(h->numSHEntries == 0) { // THIS BRANCH IS IMPOSSIBLE TO BE EXECUTED!!!
printf_dump(LOG_DEBUG, "Read number of Sections in 1st Section\n");
// read 1st section header and grab actual number from here
// ...
h->numSHEntries = section.sh_size;
}
}
```
`h->numSHEntries` has been stored with value of `e_shnum`, only when `e_shnum` is non-zero will the outter branch be executed, then the `h->numSHEntries` must be non-zero as well, then the inner branch will never be executed.
|