Skip to content

Commit

Permalink
fix: keep proper magic value in macho module
Browse files Browse the repository at this point in the history
This matches the VirusTotal/yara#2041 fix
done in yara 4.5.0
  • Loading branch information
vthib committed Feb 16, 2024
1 parent 28f8626 commit 50d418d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion boreal/src/module/macho.rs
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ fn parse_header<Mach: MachHeader<Endian = Endianness>>(
}

[
("magic", header.magic().to_be().into()),
("magic", header.magic().into()),
("cputype", cputype.into()),
("cpusubtype", cpusubtype.into()),
("filetype", header.filetype(e).into()),
Expand Down
8 changes: 8 additions & 0 deletions boreal/tests/it/libyara_compat/macho.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,14 @@ fn test_macho() {
true,
);

check_file(
"import \"macho\" rule test { condition:
macho.file[0].magic == 0xcefaedfe and
macho.file[1].magic == 0xcffaedfe }",
"tests/assets/libyara/data/tiny-universal",
true,
);

// Entry points for files (LC_MAIN)

check_file(
Expand Down

0 comments on commit 50d418d

Please sign in to comment.