Browse Source

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

Nikolay Nikolov 1 year ago
parent
commit
a6d4374f10
1 changed files with 5 additions and 0 deletions
  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