Skip to content

Commit

Permalink
fix: set pe.entry_point to -1 when not found
Browse files Browse the repository at this point in the history
  • Loading branch information
vthib committed Jan 28, 2023
1 parent 1b0d582 commit a1caa7b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions boreal/src/module/pe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,7 @@ impl Pe {
"entry_point",
sections
.and_then(|sections| va_to_file_offset(mem, &sections, ep))
.map_or(-1, i64::from)
.into(),
),
("entry_point_raw", ep.into()),
Expand Down
16 changes: 14 additions & 2 deletions boreal/tests/it/pe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,6 @@ fn test_coverage_pe_libyara_33fc70f9() {
33fc70f99be6d2833ae48852d611c8048d0c053ed0b2c626db4dbe902832a08b",
&[
"pe.rich_signature",
// FIXME: this difference should not be
"pe.entry_point",
#[cfg(not(feature = "authenticode"))]
"pe.number_of_signatures",
],
Expand Down Expand Up @@ -491,6 +489,20 @@ fn test_coverage_pe_1561_32_section1() {
);
}

#[test]
fn test_coverage_pe_c6f9709f() {
compare_module_values_on_file(
Pe::default(),
"tests/assets/libyara/data/\
c6f9709feccf42f2d9e22057182fe185f177fb9daaa2649b4669a24f2ee7e3ba_0h_410h",
&[
"pe.rich_signature",
#[cfg(not(feature = "authenticode"))]
"pe.number_of_signatures",
],
);
}

#[test]
#[cfg(feature = "hash")]
fn test_imphash() {
Expand Down

0 comments on commit a1caa7b

Please sign in to comment.