+ check the code entries count in the wasm object reader

This commit is contained in:
Nikolay Nikolov 2023-12-28 14:14:30 +02:00
parent 87a3bfe99d
commit 4b179ce4fa

View File

@ -3091,6 +3091,11 @@ implementation
InputError('Error reading the code entries cound from the code section');
exit;
end;
if CodeEntriesCount <> (Length(FuncTypes) - FuncTypeImportsCount) then
begin
InputError('Code segment count in the code section does not match the function definition count in the function section');
exit;
end;
SetLength(CodeSegments,CodeEntriesCount);
for i:=0 to CodeEntriesCount-1 do
with CodeSegments[i] do