瀏覽代碼

+ wasm object reader: range check the symbol indices of SYMTAB_FUNCTION entries

Nikolay Nikolov 1 年之前
父節點
當前提交
a6d4374f10
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      compiler/ogwasm.pas

+ 5 - 0
compiler/ogwasm.pas

@@ -2438,6 +2438,11 @@ implementation
                                 InputError('Error reading the index of a ' + SymKindName + ' symbol');
                                 exit;
                               end;
+                            if ((SymKind=byte(SYMTAB_FUNCTION)) and (SymIndex>high(FuncTypes))) then
+                              begin
+                                InputError('Symbol index too high');
+                                exit;
+                              end;
                             if ((SymFlags and WASM_SYM_EXPLICIT_NAME)<>0) or
                                ((SymFlags and WASM_SYM_UNDEFINED)=0) then
                               begin