OcAppleKernelLib: Verify Symbol is non-NULL before adding to VTable.
@@ -302,16 +302,9 @@ InternalPatchVtableSymbol (
CONST CHAR8 *ClassName;
CHAR8 FunctionPrefix[SYM_MAX_NAME_LEN];
+ ASSERT (Symbol != NULL);
ASSERT (ParentEntry != NULL);
//
- // The child entry can be NULL when a locally-defined, non-external
- // symbol is stripped. We wouldn't patch this entry anyway, so we
- // just skip it.
- //
- if (Symbol == NULL) {
- return TRUE;
- }
- //
// 1) If the symbol is defined locally, do not patch
//
if (MachoSymbolIsLocalDefined (MachoContext, Symbol)) {
@@ -477,6 +470,13 @@ InternalInitializeVtableByEntriesAndRelocations64 (
}
Symbol = SolveSymbols[SolveSymbolIndex];
+ ++SolveSymbolIndex;
+ //
+ // The child entry can be NULL when a locally-defined, non-external
+ // symbol is stripped. We wouldn't patch this entry anyway, so we
+ // just skip it.
+ //
+ if (Symbol != NULL) {
Result = InternalPatchVtableSymbol (
MachoContext,
&SuperVtable->Entries[Index],
@@ -489,8 +489,7 @@ InternalInitializeVtableByEntriesAndRelocations64 (
VtableEntry->Name = MachoGetSymbolName64 (MachoContext, Symbol);
VtableEntry->Address = Symbol->Value;
-
- ++SolveSymbolIndex;
+ }
}
++VtableEntry;
