Merge remote-tracking branch 'origin/GP-5625_ghidra007_AddNullChecks'

into patch (Closes #8045)
This commit is contained in:
Ryan Kurtz 2025-04-28 15:19:44 -04:00
commit 02221f03f5
2 changed files with 14 additions and 1 deletions

View file

@ -3437,7 +3437,9 @@ public class RTTIGccClassRecoverer extends RTTIClassRecoverer {
Function calledFunction = Function calledFunction =
extendedFlatAPI.getReferencedFunction(instruction.getMinAddress(), false); extendedFlatAPI.getReferencedFunction(instruction.getMinAddress(), false);
if (calledFunction.getName().equals(expectedCalledFunctionName)) {
if (calledFunction != null &&
calledFunction.getName().equals(expectedCalledFunctionName)) {
return instruction.getAddress(); return instruction.getAddress();
} }
} }

View file

@ -434,6 +434,10 @@ public class RecoveredClassHelper {
Function calledFunction = extendedFlatAPI Function calledFunction = extendedFlatAPI
.getReferencedFunction(instruction.getMinAddress(), getThunkedFunction); .getReferencedFunction(instruction.getMinAddress(), getThunkedFunction);
if (calledFunction == null) {
continue;
}
// include the null functions in map so things using map can get accurate count // include the null functions in map so things using map can get accurate count
// of number of CALL instructions even if the call reg type // of number of CALL instructions even if the call reg type
functionCallMap.put(instruction.getMinAddress(), calledFunction); functionCallMap.put(instruction.getMinAddress(), calledFunction);
@ -2112,6 +2116,10 @@ public class RecoveredClassHelper {
Function constructor = Function constructor =
extendedFlatAPI.getReferencedFunction(constructorReference, true); extendedFlatAPI.getReferencedFunction(constructorReference, true);
if (constructor == null) {
continue;
}
if (recoveredClass.getIndeterminateList().contains(constructor)) { if (recoveredClass.getIndeterminateList().contains(constructor)) {
addConstructorToClass(recoveredClass, constructor); addConstructorToClass(recoveredClass, constructor);
recoveredClass.removeIndeterminateConstructorOrDestructor(constructor); recoveredClass.removeIndeterminateConstructorOrDestructor(constructor);
@ -2534,6 +2542,9 @@ public class RecoveredClassHelper {
RecoveredClass recoveredClass = referenceToClassMap.get(destructorReference); RecoveredClass recoveredClass = referenceToClassMap.get(destructorReference);
Function destructor = extendedFlatAPI.getReferencedFunction(destructorReference, true); Function destructor = extendedFlatAPI.getReferencedFunction(destructorReference, true);
if (destructor == null) {
continue;
}
if (recoveredClass.getIndeterminateList().contains(destructor)) { if (recoveredClass.getIndeterminateList().contains(destructor)) {
addDestructorToClass(recoveredClass, destructor); addDestructorToClass(recoveredClass, destructor);