From c2bf8d04649a817dcc5ccc3e42a641fb2f5565bf Mon Sep 17 00:00:00 2001 From: ghidra007 Date: Wed, 17 Jul 2024 16:44:40 +0000 Subject: [PATCH] GP-4763 Added check that ClassHierarchyDescriptor symbols are not in Global namespace. If they are skip processing it and the associated class. --- .../classrecovery/RTTIWindowsClassRecoverer.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RTTIWindowsClassRecoverer.java b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RTTIWindowsClassRecoverer.java index 8d5d807070d..5cceca4fff7 100644 --- a/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RTTIWindowsClassRecoverer.java +++ b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RTTIWindowsClassRecoverer.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -868,7 +868,12 @@ private List recoverClassesFromClassHierarchyDescriptors( // Get class name from class vftable is in Namespace classNamespace = classHierarchyDescriptorSymbol.getParentNamespace(); - + if (classNamespace.isGlobal()) { + Msg.warn(this, "ClassHierarchyDescriptor at " + classHierarchyDescriptorAddress + + " is unexpectedly in the Global namespace so processing cannot continue for " + + "this class"); + continue; + } // get the data type category associated with the given class namespace Category category = getDataTypeCategory(classNamespace); @@ -2484,7 +2489,7 @@ private Map getBaseClassOffsetMap(RecoveredClass recove baseClassDescriptorAddress.toString()); continue; } - + // Continue if the class has mult inh but base class is not on the parent list if (!recoveredClass.getParentList().contains(baseClass)) { continue;