Browse Source

+ check for duplicated data sections

Nikolay Nikolov 1 year ago
parent
commit
10b201c506
1 changed files with 7 additions and 0 deletions
  1. 7 0
      compiler/ogwasm.pas

+ 7 - 0
compiler/ogwasm.pas

@@ -2220,6 +2220,7 @@ implementation
           ImportSectionRead: Boolean = false;
           FunctionSectionRead: Boolean = false;
           CodeSectionRead: Boolean = false;
+          DataSectionRead: Boolean = false;
           DataCountSectionRead: Boolean = false;
 
           DataSegments: array of record
@@ -2732,6 +2733,12 @@ implementation
         function ReadDataSection: Boolean;
           begin
             Result:=False;
+            if DataSectionRead then
+              begin
+                InputError('Data section is duplicated');
+                exit;
+              end;
+            DataSectionRead:=True;
           end;
 
         function ReadDataCountSection: Boolean;