Skip to content

Commit

Permalink
Issue gimli-rs#40 -- Use min of section virtual_size and size_of_raw_…
Browse files Browse the repository at this point in the history
…data
  • Loading branch information
Greg Solberg committed Oct 23, 2018
1 parent 8c40f47 commit b548330
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pe.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloc::borrow::Cow;
use alloc::vec::Vec;
use std::cmp;
use std::slice;

use goblin::pe;
Expand Down Expand Up @@ -112,7 +113,7 @@ where
if name == section_name {
return Some(Cow::from(
&self.data[section.pointer_to_raw_data as usize..]
[..section.virtual_size as usize],
[..cmp::min(section.virtual_size, section.size_of_raw_data) as usize]
));
}
}
Expand Down

0 comments on commit b548330

Please sign in to comment.