+ read the data count from the data section. Set size of the DataSegments

array, if the data count section hasn't been encountered. Compare the count
  with the value from the data count section, in case the data count section
  has been encountered, and issue an error, if they differ.
This commit is contained in:
Nikolay Nikolov 2023-12-26 16:44:34 +02:00
parent 10b201c506
commit e4600f5e38

View File

@ -2731,6 +2731,8 @@ implementation
end;
function ReadDataSection: Boolean;
var
DataCount: uint32;
begin
Result:=False;
if DataSectionRead then
@ -2739,6 +2741,21 @@ implementation
exit;
end;
DataSectionRead:=True;
if not ReadUleb32(DataCount) then
begin
InputError('Error reading the data entries count from the data section');
exit;
end;
if DataCountSectionRead then
begin
if Length(DataSegments)<>DataCount then
begin
InputError('Data entries count in the data section do not match the number, specified in the data count section');
exit
end;
end
else
SetLength(DataSegments,DataCount);
end;
function ReadDataCountSection: Boolean;