It likely makes sense when parsing the whole complete file, but in my case I want to just parse this section, and the offset for that section is e.g., at 0xc8e912a0 so that's quite a few bytes to read from the file for nothing. Locally just avoiding this works very well.
Would adding a SectionHeader::parse_raw() that basically is actual parse without the check, and make parse() call it after the offset check be a valid fix ?
I am unsure if this is a side effect of something else or done on purpose but let's imagine the following code:
The
SectionHeader::parse()
will fail because of https://github.com/m4b/goblin/blob/5b67d29bee4fa31766cdb9ec04062503b836701e/src/elf/section_header.rs#L449-L451It likely makes sense when parsing the whole complete file, but in my case I want to just parse this section, and the offset for that section is e.g., at
0xc8e912a0
so that's quite a few bytes to read from the file for nothing. Locally just avoiding this works very well.