Browse Source

+ function section duplicate check

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

+ 7 - 0
compiler/ogwasm.pas

@@ -2194,6 +2194,7 @@ implementation
 
           TypeSectionRead: Boolean = false;
           ImportSectionRead: Boolean = false;
+          FunctionSectionRead: Boolean = false;
 
         function ReadCustomSection: Boolean;
           begin
@@ -2547,6 +2548,12 @@ implementation
         function ReadFunctionSection: Boolean;
           begin
             Result:=False;
+            if FunctionSectionRead then
+              begin
+                InputError('Function section is duplicated');
+                exit;
+              end;
+            FunctionSectionRead:=True;
           end;
 
         function ReadGlobalSection: Boolean;