mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 05:49:12 +02:00
+ wasm internal object reader: parse the tag section
This commit is contained in:
parent
7f3ed9e85c
commit
c527437594
@ -2367,6 +2367,7 @@ implementation
|
|||||||
GlobalSectionRead: Boolean = false;
|
GlobalSectionRead: Boolean = false;
|
||||||
ExportSectionRead: Boolean = false;
|
ExportSectionRead: Boolean = false;
|
||||||
ElementSectionRead: Boolean = false;
|
ElementSectionRead: Boolean = false;
|
||||||
|
TagSectionRead: Boolean = false;
|
||||||
CodeSectionRead: Boolean = false;
|
CodeSectionRead: Boolean = false;
|
||||||
DataSectionRead: Boolean = false;
|
DataSectionRead: Boolean = false;
|
||||||
DataCountSectionRead: Boolean = false;
|
DataCountSectionRead: Boolean = false;
|
||||||
@ -3661,6 +3662,45 @@ implementation
|
|||||||
Result:=True;
|
Result:=True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function ReadTagSection: Boolean;
|
||||||
|
var
|
||||||
|
TagCount, TagTypeIdx: uint32;
|
||||||
|
i: Integer;
|
||||||
|
Attr: Byte;
|
||||||
|
begin
|
||||||
|
Result:=False;
|
||||||
|
if TagSectionRead then
|
||||||
|
begin
|
||||||
|
InputError('Tag section is duplicated');
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
TagSectionRead:=True;
|
||||||
|
if not ReadUleb32(TagCount) then
|
||||||
|
begin
|
||||||
|
InputError('Error reading the tag count from the tag section');
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
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;
|
||||||
|
if AReader.Pos<>(SectionStart+SectionSize) then
|
||||||
|
begin
|
||||||
|
InputError('Unexpected tag section size');
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
Result:=True;
|
||||||
|
end;
|
||||||
|
|
||||||
function ReadCodeSection: Boolean;
|
function ReadCodeSection: Boolean;
|
||||||
var
|
var
|
||||||
CodeEntriesCount: uint32;
|
CodeEntriesCount: uint32;
|
||||||
@ -3931,6 +3971,12 @@ implementation
|
|||||||
InputError('Error reading the element section');
|
InputError('Error reading the element section');
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
Byte(wsiTag):
|
||||||
|
if not ReadTagSection then
|
||||||
|
begin
|
||||||
|
InputError('Error reading the tag section');
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
Byte(wsiCode):
|
Byte(wsiCode):
|
||||||
if not ReadCodeSection then
|
if not ReadCodeSection then
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user