Skip to content

Commit

Permalink
fix: add sanity check that prevents parsing corrupted resources in PE…
Browse files Browse the repository at this point in the history
… files
  • Loading branch information
plusvic committed Nov 15, 2023
1 parent 6d4cc03 commit 30de7fe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion yara-x/src/modules/pe/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,8 @@ impl<'a> PE<'a> {
fn parse_rsrc_dir(input: &[u8]) -> IResult<&[u8], usize> {
map(
tuple((
le_u32, // characteristics
// characteristics must be 0
verify(le_u32, |characteristics| *characteristics == 0),
le_u32, // timestamp
le_u16, // major_version
le_u16, // minor_version
Expand Down

0 comments on commit 30de7fe

Please # to comment.