Browse Source

* check that the data count section preceeds the data section and report an error otherwise

Nikolay Nikolov 1 year ago
parent
commit
818b6e6983
1 changed files with 5 additions and 0 deletions
  1. 5 0
      compiler/ogwasm.pas

+ 5 - 0
compiler/ogwasm.pas

@@ -2769,6 +2769,11 @@ implementation
                 exit;
                 exit;
               end;
               end;
             DataCountSectionRead:=True;
             DataCountSectionRead:=True;
+            if DataSectionRead then
+              begin
+                InputError('The data count section must occur before the data section');
+                exit;
+              end;
             if not ReadUleb32(DataCount) then
             if not ReadUleb32(DataCount) then
               begin
               begin
                 InputError('Error reading the data count from the data count section');
                 InputError('Error reading the data count from the data count section');