Browse Source

+ input error message in case the type section size is unexpected/wrong

Nikolay Nikolov 1 year ago
parent
commit
01dbc63735
1 changed files with 6 additions and 1 deletions
  1. 6 1
      compiler/ogwasm.pas

+ 6 - 1
compiler/ogwasm.pas

@@ -2284,7 +2284,12 @@ implementation
                     FFuncTypes[i].add_result(wbt);
                     FFuncTypes[i].add_result(wbt);
                   end;
                   end;
               end;
               end;
-            result:=AReader.Pos=(SectionStart+SectionSize);
+            if AReader.Pos<>(SectionStart+SectionSize) then
+              begin
+                InputError('Unexpected type section size');
+                exit;
+              end;
+            Result:=true;
           end;
           end;
 
 
         function ReadImportSection: Boolean;
         function ReadImportSection: Boolean;