|
@@ -2916,7 +2916,7 @@ implementation
|
|
|
|
|
|
function ReadFunctionSection: Boolean;
|
|
function ReadFunctionSection: Boolean;
|
|
var
|
|
var
|
|
- FunctionsCount, typidx: uint32;
|
|
|
|
|
|
+ FunctionsCount: uint32;
|
|
i: Integer;
|
|
i: Integer;
|
|
begin
|
|
begin
|
|
Result:=False;
|
|
Result:=False;
|
|
@@ -2931,19 +2931,22 @@ implementation
|
|
InputError('Error reading the functions count');
|
|
InputError('Error reading the functions count');
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
|
|
+ SetLength(FuncTypes, FuncTypeImportsCount + FunctionsCount);
|
|
for i:=0 to FunctionsCount-1 do
|
|
for i:=0 to FunctionsCount-1 do
|
|
- begin
|
|
|
|
- if not ReadUleb32(typidx) then
|
|
|
|
- begin
|
|
|
|
- InputError('Error reading type index for function');
|
|
|
|
- exit;
|
|
|
|
- end;
|
|
|
|
- if typidx>high(FFuncTypes) then
|
|
|
|
- begin
|
|
|
|
- InputError('Type index in the function section exceeds bounds of the types table');
|
|
|
|
- exit;
|
|
|
|
- end;
|
|
|
|
- end;
|
|
|
|
|
|
+ with FuncTypes[i + FuncTypeImportsCount] do
|
|
|
|
+ begin
|
|
|
|
+ IsImport:=False;
|
|
|
|
+ if not ReadUleb32(typidx) then
|
|
|
|
+ begin
|
|
|
|
+ InputError('Error reading type index for function');
|
|
|
|
+ exit;
|
|
|
|
+ end;
|
|
|
|
+ if typidx>high(FFuncTypes) then
|
|
|
|
+ begin
|
|
|
|
+ InputError('Type index in the function section exceeds bounds of the types table');
|
|
|
|
+ exit;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
if AReader.Pos<>(SectionStart+SectionSize) then
|
|
if AReader.Pos<>(SectionStart+SectionSize) then
|
|
begin
|
|
begin
|
|
InputError('Unexpected function section size');
|
|
InputError('Unexpected function section size');
|