From 83995ada1fd534fc35112eecd902fd574ebc1cb6 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Wed, 21 May 2025 16:22:32 +0200 Subject: [PATCH] LibWasm: Quit early in memory_fill if store_to_memory traps We shouldn't try to run the next 'instruction' if we trap. Unbreaks the memory-fill test in wpt. --- Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp b/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp index be2ef9d854f..e163d7f37b2 100644 --- a/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp +++ b/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp @@ -662,8 +662,11 @@ ALWAYS_INLINE void BytecodeInterpreter::interpret_instruction(Configuration& con if (count == 0) return; - for (u32 i = 0; i < count; ++i) + for (u32 i = 0; i < count; ++i) { store_to_memory(configuration, Instruction::MemoryArgument { 0, 0 }, { &value, sizeof(value) }, destination_offset + i); + if (did_trap()) + return; + } return; }