Skip to content

Commit

Permalink
Merge pull request #175 from chaoticgd/get_virtual_fix
Browse files Browse the repository at this point in the history
Fix out of bounds vector access
  • Loading branch information
chaoticgd authored Feb 13, 2024
2 parents d84721d + e27f6ac commit 26888a7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ccc/elf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Result<std::span<const u8>> ElfFile::get_virtual(u32 address, u32 size) const
size_t begin_offset = segment.offset + (address - segment.address.value);
size_t end_offset = begin_offset + size;
if(end_offset <= image.size()) {
return std::span<const u8>(&image[begin_offset], &image[end_offset]);
return std::span<const u8>(image.data() + begin_offset, image.data() + end_offset);
}
}
}
Expand Down

0 comments on commit 26888a7

Please sign in to comment.