From 7826c006c12415397ec5ebda2fb0e45ee1ad9666 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 6 Nov 2023 15:23:05 +0100 Subject: [PATCH] LibJS/JIT: Don't crash when dissassembling an empty basic block --- Userland/Libraries/LibJS/JIT/NativeExecutable.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibJS/JIT/NativeExecutable.cpp b/Userland/Libraries/LibJS/JIT/NativeExecutable.cpp index d6fe7c23cc..2b469b4319 100644 --- a/Userland/Libraries/LibJS/JIT/NativeExecutable.cpp +++ b/Userland/Libraries/LibJS/JIT/NativeExecutable.cpp @@ -118,9 +118,11 @@ void NativeExecutable::dump_disassembly([[maybe_unused]] Bytecode::Executable co if (mapping->bytecode_offset == 0) dbgln("\nBlock {}:", mapping->block_index + 1); - VERIFY(mapping->bytecode_offset < block.size()); - auto const& instruction = *reinterpret_cast(block.data() + mapping->bytecode_offset); - dbgln("{}:{:x} {}:", mapping->block_index + 1, mapping->bytecode_offset, instruction.to_deprecated_string(executable)); + if (block.size() != 0) { + VERIFY(mapping->bytecode_offset < block.size()); + auto const& instruction = *reinterpret_cast(block.data() + mapping->bytecode_offset); + dbgln("{}:{:x} {}:", mapping->block_index + 1, mapping->bytecode_offset, instruction.to_deprecated_string(executable)); + } } }