Skip to content

Commit

Permalink
Use ReadRaw::read_array() in Gsym parsing code
Browse files Browse the repository at this point in the history
We don't have to use the ReadRaw::read_slice() method in conjunction
with a fallible cast to read a compile-time-sized amount of bytes, but
can use the ReadRaw::read_array() helper.

Signed-off-by: Daniel Müller <[email protected]>
  • Loading branch information
d-e-s-o authored and danielocfb committed Jan 3, 2025
1 parent fb567a3 commit 94946ca
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/gsym/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ impl GsymContext<'_> {
let num_addrs = data.read_u32()?;
let strtab_offset = data.read_u32()?;
let strtab_size = data.read_u32()?;
// SANITY: We know that the slice has 20 elements if read
// successful.
let uuid = <[u8; 20]>::try_from(data.read_slice(20)?).unwrap();
let uuid = data.read_array::<20>()?;

let addr_tab = data.read_slice(num_addrs as usize * usize::from(addr_off_size))?;
let () = data.align(align_of::<u32>())?;
Expand Down

0 comments on commit 94946ca

Please sign in to comment.