From 08b567e137de47f3171ac3b1d2b39a0839d3fc85 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Sun, 30 May 2021 00:45:22 +0430 Subject: [PATCH] LibWasm: Avoid OOB accesses caused by user input Just trap instead of crashing. --- .../Libraries/LibWasm/AbstractMachine/Interpreter.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWasm/AbstractMachine/Interpreter.cpp b/Userland/Libraries/LibWasm/AbstractMachine/Interpreter.cpp index c0cbc0d57f..a29c3e8a07 100644 --- a/Userland/Libraries/LibWasm/AbstractMachine/Interpreter.cpp +++ b/Userland/Libraries/LibWasm/AbstractMachine/Interpreter.cpp @@ -421,7 +421,7 @@ void BytecodeInterpreter::interpret(Configuration& configuration, InstructionPoi TRAP_IF_NOT(label.has_value()); size_t end = configuration.stack().size() - label->arity() - 1; size_t start = end; - while (start > 0 && !configuration.stack().entries()[start].has