+ wasm internal object reader: validate that relocations that should point to a SYMTAB_FUNCTION entry, actually point to such entry

This commit is contained in:
Nikolay Nikolov 2024-01-06 20:30:20 +02:00
parent baf9681684
commit 3071ae231a

View File

@ -2678,6 +2678,15 @@ implementation
InputError('R_WASM_SECTION_OFFSET_I32 must point to a SYMTAB_SECTION symbol');
exit;
end;
if (RelocType in [
R_WASM_FUNCTION_INDEX_LEB,
R_WASM_TABLE_INDEX_SLEB,
R_WASM_TABLE_INDEX_I32,
R_WASM_FUNCTION_OFFSET_I32]) and (SymbolTable[RelocIndex].SymKind<>SYMTAB_FUNCTION) then
begin
InputError('Relocation must point to a SYMTAB_FUNCTION symbol');
exit;
end;
end;
if AReader.Pos<>(SectionStart+SectionSize) then
begin