diff --git a/CHANGELOG.md b/CHANGELOG.md index c4362669355..9d24118bfb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Changelog ## **[Unreleased]** -- [#1590](https://github.com/wasmerio/wasmer/pull/1590) Fix soundness issue in API on vm::Global +- [#1590](https://github.com/wasmerio/wasmer/pull/1590) Fix soundness issue in API of vm::Global - [#1566](https://github.com/wasmerio/wasmer/pull/1566) Add support for opening special Unix files to the WASI FS ## TODO: 1.0.0-alpha1.0 diff --git a/lib/vm/src/global.rs b/lib/vm/src/global.rs index f33ccaf99a0..d1ff6937fd4 100644 --- a/lib/vm/src/global.rs +++ b/lib/vm/src/global.rs @@ -69,8 +69,8 @@ impl Global { unsafe { let definition = &*self.vm_global_definition.get(); match self.ty().ty { - Type::I32 => Value::from(*definition.as_i32()), - Type::I64 => Value::from(*definition.as_i64()), + Type::I32 => Value::I32(*definition.as_i32()), + Type::I64 => Value::I64(*definition.as_i64()), Type::F32 => Value::F32(*definition.as_f32()), Type::F64 => Value::F64(*definition.as_f64()), Type::V128 => Value::V128(*definition.as_u128()), @@ -104,7 +104,7 @@ impl Global { /// The caller should also ensure that this global is synchronized. Otherwise, use /// `set` instead. pub unsafe fn set_unchecked(&self, val: Value) -> Result<(), GlobalError> { - // ideally we'd use atomics here + // ideally we'd use atomics for the global value rather than needing to lock it let definition = &mut *self.vm_global_definition.get(); match val { Value::I32(i) => *definition.as_i32_mut() = i,