Skip to content

Commit

Permalink
Fix out of bounds vector access
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoticgd committed Feb 13, 2024
1 parent d84721d commit e27f6ac
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 e27f6ac

Please sign in to comment.