From 3ee627909affafdd8d51df8272e32a7d55f3ca9d Mon Sep 17 00:00:00 2001 From: Matthew Olsson Date: Sun, 13 Jun 2021 08:50:05 -0700 Subject: [PATCH] LibJS: Ensure GetBy{Id,Value} never load into the accumulator --- Userland/Libraries/LibJS/Bytecode/Op.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index d0959adc09..6dfe48a42e 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -151,7 +151,7 @@ void SetVariable::execute_impl(Bytecode::Interpreter& interpreter) const void GetById::execute_impl(Bytecode::Interpreter& interpreter) const { if (auto* object = interpreter.accumulator().to_object(interpreter.global_object())) - interpreter.accumulator() = object->get(interpreter.current_executable().get_string(m_property)); + interpreter.accumulator() = object->get(interpreter.current_executable().get_string(m_property)).value_or(js_undefined()); } void PutById::execute_impl(Bytecode::Interpreter& interpreter) const @@ -328,7 +328,7 @@ void GetByValue::execute_impl(Bytecode::Interpreter& interpreter) const auto property_key = interpreter.accumulator().to_property_key(interpreter.global_object()); if (interpreter.vm().exception()) return; - interpreter.accumulator() = object->get(property_key); + interpreter.accumulator() = object->get(property_key).value_or(js_undefined()); } }