You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. AFAIK sh_offset field is completely meaningless in case of SHT_NOBITS section. Sometimes it is equal to 0: I encountered such a binary "in the wild". In this case, however, you cannot write the (valid) binary parsed by the ELF builder: it throws an error.
Probably the simplest possible solution would be to add another conditional (section.sh_type != SHT_NOBITS) around this fragments of code from build/elf.rs:
if section.sh_offset < writer.reserved_len()asu64{ ...}
// The input sh_offset needs to be preserved so that offsets in program// headers are correct.
writer.reserve_until(section.sh_offsetasusize);
if out_section.offsetasu64 != section.sh_offset{...}
Let me know what do you think.
The text was updated successfully, but these errors were encountered:
Hello. AFAIK
sh_offset
field is completely meaningless in case ofSHT_NOBITS
section. Sometimes it is equal to0
: I encountered such a binary "in the wild". In this case, however, you cannotwrite
the (valid) binary parsed by the ELF builder: it throws an error.Probably the simplest possible solution would be to add another conditional (
section.sh_type != SHT_NOBITS
) around this fragments of code frombuild/elf.rs
:Let me know what do you think.
The text was updated successfully, but these errors were encountered: