New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't work on /bin/busybox #28
Comments
thanks for the issue! it looks like 6495cfee9ce7219e4fe1dde5953a2c73b01a8382 in goblin (m4b/goblin#243) introduced this issue.
though it still has a regression compared to 0.2.0 that can succesfully parse out some of the shdr relocs |
@m4b your patch would suppress the error but also prevent parsing the relocation entry. I believe, that the section size check is wrong for relocation entries. m4b/goblin#243 added effectively checks for let (end, overflow) = self.sh_addr.overflowing_add(self.sh_size);
if overflow || end > size as u64 { I believe that comparing the virtual memory range with the physical file size is not valid in this context, and the correct patch would be: diff --git a/src/elf/section_header.rs b/src/elf/section_header.rs
index 308606b..22cfdf2 100644
--- a/src/elf/section_header.rs
+++ b/src/elf/section_header.rs
@@ -474,7 +474,7 @@ if_alloc! {
return Err(error::Error::Malformed(message));
}
let (end, overflow) = self.sh_addr.overflowing_add(self.sh_size);
- if overflow || end > size as u64 {
+ if overflow {
let message = format!("Section {} size ({}) + addr ({}) is out of bounds. Overflowed: {}",
self.sh_name, self.sh_addr, self.sh_size, overflow);
return Err(error::Error::Malformed(message)); |
Confirmed your patch fixes, and latest goblin is released, and bingrep updated to use it with lockfile; also tagged new release :) thanks for everyone's help and involvement here, including the bug report! :D |
bingrep
errors out on/bin/busybox
with the following message:Environment
Built at c3516e7.
readelf /bin/busybox
works fine.The text was updated successfully, but these errors were encountered: