Skip to content

Commit

Permalink
feature: add test-framework PoC
Browse files Browse the repository at this point in the history
  • Loading branch information
TommYDeeee committed Oct 3, 2023
1 parent 107275c commit 3503f23
Show file tree
Hide file tree
Showing 6 changed files with 17,916 additions and 3 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions yara-x/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ yara-x-proto = { workspace = true }
criterion = { workspace = true }
pretty_assertions = { workspace = true }
wasmprinter = "0.2.62"
ihex = "3.0.0"
yara = { version = "0.19.0", features = ["vendored"] }

[[bench]]
Expand Down
14 changes: 12 additions & 2 deletions yara-x/src/modules/macho/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,10 @@ fn handle_segment_command(
cmd: Some(sg.cmd),
cmdsize: Some(sg.cmdsize),
segname: Some(
std::str::from_utf8(&sg.segname).unwrap_or_default().to_string(),
std::str::from_utf8(&sg.segname)
.unwrap_or_default()
.trim_end_matches('\0')
.to_string(),
),
vmaddr: Some(sg.vmaddr as u64),
vmsize: Some(sg.vmsize as u64),
Expand Down Expand Up @@ -1469,11 +1472,13 @@ fn handle_segment_command(
segname: Some(
std::str::from_utf8(&sec.segname)
.unwrap_or_default()
.trim_end_matches('\0')
.to_string(),
),
sectname: Some(
std::str::from_utf8(&sec.sectname)
.unwrap_or_default()
.trim_end_matches('\0')
.to_string(),
),
addr: Some(sec.addr as u64),
Expand Down Expand Up @@ -1552,7 +1557,10 @@ fn handle_segment_command_64(
cmd: Some(sg.cmd),
cmdsize: Some(sg.cmdsize),
segname: Some(
std::str::from_utf8(&sg.segname).unwrap_or_default().to_string(),
std::str::from_utf8(&sg.segname)
.unwrap_or_default()
.trim_end_matches('\0')
.to_string(),
),
vmaddr: Some(sg.vmaddr),
vmsize: Some(sg.vmsize),
Expand Down Expand Up @@ -1584,11 +1592,13 @@ fn handle_segment_command_64(
segname: Some(
std::str::from_utf8(&sec.segname)
.unwrap_or_default()
.trim_end_matches('\0')
.to_string(),
),
sectname: Some(
std::str::from_utf8(&sec.sectname)
.unwrap_or_default()
.trim_end_matches('\0')
.to_string(),
),
addr: Some(sec.addr),
Expand Down
Loading

0 comments on commit 3503f23

Please sign in to comment.