From eff2c42ce814c71a8b2a8329ffe32c20b0ddcd03 Mon Sep 17 00:00:00 2001 From: alpharush <0xalpharush@protonmail.com> Date: Mon, 6 Nov 2023 13:55:52 -0600 Subject: [PATCH] fix: prevent potential UB by deriving repr C for union --- lib/vm/src/vmcontext.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/vm/src/vmcontext.rs b/lib/vm/src/vmcontext.rs index dcb5b0cd699..520d100d215 100644 --- a/lib/vm/src/vmcontext.rs +++ b/lib/vm/src/vmcontext.rs @@ -23,6 +23,7 @@ use wasmer_types::RawValue; /// It may either be a pointer to the [`VMContext`] if it's a Wasm function /// or a pointer to arbitrary data controlled by the host if it's a host function. #[derive(Copy, Clone, Eq)] +#[repr(C)] pub union VMFunctionContext { /// Wasm functions take a pointer to [`VMContext`]. pub vmctx: *mut VMContext,