Skip to content

Commit

Permalink
archive: fix unbound access to member_offsets in archive/mod.rs:342
Browse files Browse the repository at this point in the history
  • Loading branch information
anfedotoff authored Sep 12, 2022
1 parent 59ec2f3 commit f9c3448
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/archive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,13 @@ impl<'a> Index<'a> {

let mut symbol_offsets = Vec::with_capacity(symbols);
for _ in 0..symbols {
symbol_offsets
.push(member_offsets[buffer.gread_with::<u16>(offset, scroll::LE)? as usize - 1]);
if let Some(symbol_offset) =
member_offsets.get(buffer.gread_with::<u16>(offset, scroll::LE)? as usize - 1)
{
symbol_offsets.push(*symbol_offset);
} else {
return Err(Error::BufferTooShort(members, "members"));
}
}
let strtab = strtab::Strtab::parse(buffer, *offset, buffer.len() - *offset, 0x0)?;
Ok(Index {
Expand Down

0 comments on commit f9c3448

Please sign in to comment.