diff --git a/decompiler/IR2/AtomicOpTypeAnalysis.cpp b/decompiler/IR2/AtomicOpTypeAnalysis.cpp index 4761dfa57..1b4e4cc3e 100644 --- a/decompiler/IR2/AtomicOpTypeAnalysis.cpp +++ b/decompiler/IR2/AtomicOpTypeAnalysis.cpp @@ -772,11 +772,13 @@ TP_Type LoadVarOp::get_src_type(const TypeState& input, ro.offset >= 16 && (ro.offset & 3) == 0 && m_size == 4 && m_kind == Kind::UNSIGNED) { // method get of an unknown type. We assume the most general "object" type. auto method_id = (ro.offset - 16) / 4; - auto method_info = dts.ts.lookup_method("object", method_id); - if (method_id != GOAL_NEW_METHOD && method_id != GOAL_RELOC_METHOD) { - // this can get us the wrong thing for `new` methods. And maybe relocate? - return TP_Type::make_non_virtual_method( - method_info.type.substitute_for_method_call("object"), TypeSpec("object"), method_id); + if (method_id <= (int)GOAL_MEMUSAGE_METHOD) { + auto method_info = dts.ts.lookup_method("object", method_id); + if (method_id != GOAL_NEW_METHOD && method_id != GOAL_RELOC_METHOD) { + // this can get us the wrong thing for `new` methods. And maybe relocate? + return TP_Type::make_non_virtual_method( + method_info.type.substitute_for_method_call("object"), TypeSpec("object"), method_id); + } } }