Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/hyperlight_host/src/sandbox/uninitialized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ impl

/// A `GuestBinary` is either a buffer containing the binary or a path to the binary
#[derive(Debug)]
pub enum GuestBinary {
pub enum GuestBinary<'a> {
/// A buffer containing the guest binary
Buffer(Vec<u8>),
Buffer(&'a [u8]),
/// A path to the guest binary
FilePath(String),
}
Expand Down Expand Up @@ -372,15 +372,15 @@ mod tests {

let binary_path = simple_guest_as_string().unwrap();
let sandbox =
UninitializedSandbox::new(GuestBinary::Buffer(fs::read(binary_path).unwrap()), None);
UninitializedSandbox::new(GuestBinary::Buffer(&fs::read(binary_path).unwrap()), None);
assert!(sandbox.is_ok());

// Test with a invalid guest binary buffer

let binary_path = simple_guest_as_string().unwrap();
let mut bytes = fs::read(binary_path).unwrap();
let _ = bytes.split_off(100);
let sandbox = UninitializedSandbox::new(GuestBinary::Buffer(bytes), None);
let sandbox = UninitializedSandbox::new(GuestBinary::Buffer(&bytes), None);
assert!(sandbox.is_err());
}

Expand Down
Loading