Browse Source

+ import section duplicate check

Nikolay Nikolov 1 year ago
parent
commit
e6a3aa3450
1 changed files with 8 additions and 0 deletions
  1. 8 0
      compiler/ogwasm.pas

+ 8 - 0
compiler/ogwasm.pas

@@ -2176,6 +2176,7 @@ implementation
           SectionStart: LongInt;
 
           TypeSectionRead: Boolean = false;
+          ImportSectionRead: Boolean = false;
 
         function ReadCustomSection: Boolean;
           begin
@@ -2295,6 +2296,13 @@ implementation
         function ReadImportSection: Boolean;
           begin
             Result:=False;
+            if ImportSectionRead then
+              begin
+                InputError('Import section is duplicated');
+                exit;
+              end;
+            ImportSectionRead:=True;
+
           end;
 
         function ReadFunctionSection: Boolean;