mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-25 22:51:32 +00:00
test(interface-types) Test negative pointer or length in string.lift_memory
.
This commit is contained in:
@ -222,6 +222,42 @@ mod tests {
|
|||||||
stack: [InterfaceValue::String("".into())],
|
stack: [InterfaceValue::String("".into())],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
test_executable_instruction!(
|
||||||
|
test_string_lift_memory__negative_pointer =
|
||||||
|
instructions: [
|
||||||
|
Instruction::ArgumentGet { index: 0 },
|
||||||
|
Instruction::ArgumentGet { index: 1 },
|
||||||
|
Instruction::StringLiftMemory,
|
||||||
|
],
|
||||||
|
invocation_inputs: [
|
||||||
|
InterfaceValue::I32(-42),
|
||||||
|
InterfaceValue::I32(13),
|
||||||
|
],
|
||||||
|
instance: Instance {
|
||||||
|
memory: Memory::new("Hello!".as_bytes().iter().map(|u| Cell::new(*u)).collect()),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
error: r#"`string.lift_memory` read the value of `pointer` which must be positive"#,
|
||||||
|
);
|
||||||
|
|
||||||
|
test_executable_instruction!(
|
||||||
|
test_string_lift_memory__negative_length =
|
||||||
|
instructions: [
|
||||||
|
Instruction::ArgumentGet { index: 0 },
|
||||||
|
Instruction::ArgumentGet { index: 1 },
|
||||||
|
Instruction::StringLiftMemory,
|
||||||
|
],
|
||||||
|
invocation_inputs: [
|
||||||
|
InterfaceValue::I32(0),
|
||||||
|
InterfaceValue::I32(-1),
|
||||||
|
],
|
||||||
|
instance: Instance {
|
||||||
|
memory: Memory::new("Hello!".as_bytes().iter().map(|u| Cell::new(*u)).collect()),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
error: r#"`string.lift_memory` read the value of `length` which must be positive"#,
|
||||||
|
);
|
||||||
|
|
||||||
test_executable_instruction!(
|
test_executable_instruction!(
|
||||||
test_string_lift_memory__read_out_of_memory =
|
test_string_lift_memory__read_out_of_memory =
|
||||||
instructions: [
|
instructions: [
|
||||||
|
Reference in New Issue
Block a user