mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 20:09:25 +02:00
+ wasm internal object reader: added range check to the reader of the SymKind field
This commit is contained in:
parent
f3401c3f53
commit
b35c118244
@ -2752,6 +2752,7 @@ implementation
|
||||
SymCount: uint32;
|
||||
i: Integer;
|
||||
SymKindName: string;
|
||||
SymKindB: Byte;
|
||||
begin
|
||||
Result:=False;
|
||||
if SymbolTableSectionRead then
|
||||
@ -2769,11 +2770,17 @@ implementation
|
||||
for i:=0 to SymCount-1 do
|
||||
with SymbolTable[i] do
|
||||
begin
|
||||
if not Read(SymKind,1) then
|
||||
if not Read(SymKindB,1) then
|
||||
begin
|
||||
InputError('Error reading symbol type from the WASM_SYMBOL_TABLE subsection of the ''linking'' section');
|
||||
exit;
|
||||
end;
|
||||
if (SymKindB<Low(Ord(TWasmSymbolType))) or (SymKindB>High(Ord(TWasmSymbolType))) then
|
||||
begin
|
||||
InputError('Unsupported symbol type from the WASM_SYMBOL_TABLE subsection of the ''linking'' section');
|
||||
exit;
|
||||
end;
|
||||
SymKind:=TWasmSymbolType(SymKindB);
|
||||
if not ReadUleb32(SymFlags) then
|
||||
begin
|
||||
InputError('Error reading symbol flags from the WASM_SYMBOL_TABLE subsection of the ''linking'' section');
|
||||
|
Loading…
Reference in New Issue
Block a user