From 7060389698a7fd4cacd6ac06454277ffe14d4608 Mon Sep 17 00:00:00 2001 From: Julian Stecklina Date: Wed, 15 Mar 2023 21:53:19 +0100 Subject: [PATCH] stub: add safety comment for PE parsing --- rust/stub/src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust/stub/src/main.rs b/rust/stub/src/main.rs index 5d5dc6f..61e7b94 100644 --- a/rust/stub/src/main.rs +++ b/rust/stub/src/main.rs @@ -177,6 +177,10 @@ fn main(handle: Handle, mut system_table: SystemTable) -> Status { print_logo(); + // SAFETY: We get a slice that represents our currently running + // image and then parse the PE data structures from it. This is + // safe, because we don't touch any data in the data sections that + // might conceivably change while we look at the slice. let config: EmbeddedConfiguration = unsafe { EmbeddedConfiguration::new( booted_image_file(system_table.boot_services())