浏览代码

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

Nikolay Nikolov 2 年之前
父节点
当前提交
01dbc63735
共有 1 个文件被更改,包括 6 次插入1 次删除
  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;