+ wasm object reader: range check the symbol indices of SYMTAB_FUNCTION entries

This commit is contained in:
Nikolay Nikolov 2023-12-27 14:52:37 +02:00
parent efc4ab7928
commit a6d4374f10

View File

@ -2438,6 +2438,11 @@ implementation
InputError('Error reading the index of a ' + SymKindName + ' symbol');
exit;
end;
if ((SymKind=byte(SYMTAB_FUNCTION)) and (SymIndex>high(FuncTypes))) then
begin
InputError('Symbol index too high');
exit;
end;
if ((SymFlags and WASM_SYM_EXPLICIT_NAME)<>0) or
((SymFlags and WASM_SYM_UNDEFINED)=0) then
begin