+ wasm internal object reader: store the tags from the tag section in the TagTypes array

This commit is contained in:
Nikolay Nikolov 2024-01-07 01:23:05 +02:00
parent 55002d1905
commit 2de0bcb8d0

View File

@ -3694,9 +3694,8 @@ implementation
function ReadTagSection: Boolean;
var
TagCount, TagTypeIdx: uint32;
TagCount: uint32;
i: Integer;
Attr: Byte;
begin
Result:=False;
if TagSectionRead then
@ -3710,19 +3709,21 @@ implementation
InputError('Error reading the tag count from the tag section');
exit;
end;
SetLength(TagTypes,Length(TagTypes)+TagCount);
for i:=0 to TagCount-1 do
begin
if not Read(Attr,1) then
begin
InputError('Error reading tag attribute');
exit;
end;
if not ReadUleb32(TagTypeIdx) then
begin
InputError('Error reading tag type index');
exit;
end;
end;
with TagTypes[i + TagTypeImportsCount] do
begin
if not Read(TagAttr,1) then
begin
InputError('Error reading tag attribute');
exit;
end;
if not ReadUleb32(TagTypeIdx) then
begin
InputError('Error reading tag type index');
exit;
end;
end;
if AReader.Pos<>(SectionStart+SectionSize) then
begin
InputError('Unexpected tag section size');