Skip to content

Commit

Permalink
move td-uefi-pi fuzz folder
Browse files Browse the repository at this point in the history
Signed-off-by: OuyangHang33 <[email protected]>
  • Loading branch information
OuyangHang33 committed Mar 11, 2024
1 parent b2c5ffe commit f5907b3
Show file tree
Hide file tree
Showing 15 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion sh_script/fuzzing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ readonly script_name=${0##*/}

fuzz_folder=(
"td-loader"
"td-shim-interface/src"
"td-shim-interface"
"td-shim"
)

Expand Down
2 changes: 1 addition & 1 deletion sh_script/rudra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ paths=(
"td-paging"
"td-payload"
"td-shim"
"td-shim-interface/src"
"td-shim-interface"
"td-shim-tools"
"tdx-tdcall"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

[package]
name = "td-uefi-pi-fuzz"
name = "td-shim-interface-fuzz"
version = "0.0.0"
authors = ["Automatically generated"]
publish = false
Expand All @@ -15,7 +15,7 @@ afl = {version = "*", optional = true }
r-efi = "3.2.0"
arbitrary = "=1.1.3"

[dependencies.td-uefi-pi]
[dependencies.td-shim-interface]
path = ".."

# Prevent this from interfering with workspaces
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions td-shim-interface/src/td_uefi_pi/fv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ mod test {

#[test]
fn test_get_image_from_fv() {
let bytes = include_bytes!("../fuzz/seeds/payload_parser/fv_buffer");
let bytes = include_bytes!("../../fuzz/seeds/payload_parser/fv_buffer");

let res = get_image_from_fv(bytes, FV_FILETYPE_DXE_CORE, SECTION_PE32);

Expand Down Expand Up @@ -239,7 +239,7 @@ mod test {

#[test]
fn test_get_image_from_fv_with_wrong_fv_file_type() {
let bytes = include_bytes!("../fuzz/seeds/payload_parser/fv_buffer");
let bytes = include_bytes!("../../fuzz/seeds/payload_parser/fv_buffer");

// Cannot find fv file type FV_FILETYPE_PEI_CORE
let res = get_image_from_fv(bytes, FV_FILETYPE_PEI_CORE, SECTION_PE32);
Expand All @@ -249,7 +249,7 @@ mod test {

#[test]
fn test_get_image_from_fv_with_wrong_section_type() {
let bytes = include_bytes!("../fuzz/seeds/payload_parser/fv_buffer");
let bytes = include_bytes!("../../fuzz/seeds/payload_parser/fv_buffer");

// Cannot find section type SECTION_PIC
let res = get_image_from_fv(bytes, FV_FILETYPE_DXE_CORE, SECTION_PIC);
Expand All @@ -259,7 +259,7 @@ mod test {

#[test]
fn test_get_file_from_fv() {
let bytes = include_bytes!("../fuzz/seeds/cfv_parser/cfv");
let bytes = include_bytes!("../../fuzz/seeds/cfv_parser/cfv");

let res = get_file_from_fv(bytes, FV_FILETYPE_RAW, TEST_GUID1);

Expand Down Expand Up @@ -288,7 +288,7 @@ mod test {

#[test]
fn test_get_file_from_fv_with_wrong_guid() {
let bytes = include_bytes!("../fuzz/seeds/cfv_parser/cfv");
let bytes = include_bytes!("../../fuzz/seeds/cfv_parser/cfv");

// Cannot find this GUID
let res = get_file_from_fv(bytes, FV_FILETYPE_RAW, TEST_GUID2);
Expand Down
6 changes: 3 additions & 3 deletions td-shim-interface/src/td_uefi_pi/hob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ mod tests {
#[test]
fn test_check_hob_integrity() {
const EFI_END_OF_HOB_LIST_OFFSET: usize = 48;
let hob = &include_bytes!("../fuzz/seeds/hob_parser/hob_buffer")[..];
let hob = &include_bytes!("../../fuzz/seeds/hob_parser/hob_buffer")[..];
let mut test_hob = hob.to_vec();
let ptr = test_hob.as_ptr() as u64;
if test_hob.len() >= size_of::<HandoffInfoTable>() {
Expand All @@ -495,14 +495,14 @@ mod tests {

#[test]
fn test_get_total_memory_top() {
let hob = &include_bytes!("../fuzz/seeds/hob_parser/hob_buffer")[..];
let hob = &include_bytes!("../../fuzz/seeds/hob_parser/hob_buffer")[..];

assert!(get_total_memory_top(hob).is_some());
}

#[test]
fn test_seek_to_next_hob() {
let hob = &include_bytes!("../fuzz/seeds/hob_parser/hob_buffer")[..];
let hob = &include_bytes!("../../fuzz/seeds/hob_parser/hob_buffer")[..];

assert!(seek_to_next_hob(hob).is_some());
}
Expand Down

0 comments on commit f5907b3

Please sign in to comment.