From 932abd0cb2ba2ee894901e614943d388a5d46bf9 Mon Sep 17 00:00:00 2001 From: Jur van den Berg Date: Thu, 18 Apr 2019 00:20:37 +0200 Subject: [PATCH] Fix disassembly INVOKEVIRTUAL without symbols If there were no debug symbols, the constant pool isn't extended to hold all methods. This caused a method name resolution to fail if main called a method. This change takes care of this edge case and immediately resolves to None, causing the default placeholders to be generated. --- src/disassembler.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/disassembler.rs b/src/disassembler.rs index f5cf1ce..eefeef0 100644 --- a/src/disassembler.rs +++ b/src/disassembler.rs @@ -54,6 +54,9 @@ impl DebugSymbols { } fn lookup_method_idx(&self, idx: usize) -> Option { + if idx >= self.constants.len() { + return None; + } match self.methods.get(&self.constants[idx]) { Some(name) => Some(name.to_string()), None => None,