Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -4389,6 +4389,9 @@ impl Instance {

let lower_cx = &mut LowerContext::new(store, options, self);
let debug_msg_address = usize::try_from(debug_msg_address)?;
if debug_msg_address % usize::try_from(<str as ComponentType>::ALIGN32)? != 0 {
bail!("invalid debug message pointer: not aligned");
}
// Lower the string into the component's memory.
//
// Note that the "8" here is the size of a WIT `string` in linear
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,9 @@
(component instance $A $A)
(assert_return (invoke "run" (u32.const 65528)))
(assert_trap (invoke "run" (u32.const 65532)) "invalid debug message pointer")

(component instance $A2 $A)
(assert_trap (invoke "run" (u32.const 1)) "invalid debug message pointer: not aligned")

(component instance $A3 $A)
(assert_trap (invoke "run" (u32.const 65526)) "invalid debug message pointer: not aligned")
Loading