Fix up some more issues with Waterbox and 0 size elf data (#3590)

This commit is contained in:
nattthebear 2023-03-23 08:28:10 -04:00 committed by GitHub
parent 480b51b274
commit 64512851fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View File

@ -148,7 +148,11 @@ impl ElfLoader {
if prot_addr.size != 0 {
// TODO: Using no_replace false here because the linker puts eh_frame_hdr in a separate segment that overlaps the other RO segment???
b.mmap_fixed(prot_addr, Protection::RW, false)?;
b.copy_from_external(&data[segment.file_range()], addr.start)?;
let src_data = &data[segment.file_range()];
if src_data.len() != 0 {
b.copy_from_external(src_data, addr.start)?;
}
b.mprotect(prot_addr, prot)?;
}
}