Browse Source

+ wasm internal object reader: range check event symbols against the tag index space (imports + tag section)

Nikolay Nikolov 1 year ago
parent
commit
09accffd28
1 changed files with 2 additions and 1 deletions
  1. 2 1
      compiler/ogwasm.pas

+ 2 - 1
compiler/ogwasm.pas

@@ -2825,7 +2825,8 @@ implementation
                                 InputError('Error reading the index of a ' + SymKindName + ' symbol');
                                 InputError('Error reading the index of a ' + SymKindName + ' symbol');
                                 exit;
                                 exit;
                               end;
                               end;
-                            if ((SymKind=SYMTAB_FUNCTION) and (SymIndex>high(FuncTypes))) then
+                            if ((SymKind=SYMTAB_FUNCTION) and (SymIndex>high(FuncTypes))) or
+                               ((SymKind=SYMTAB_EVENT) and (SymIndex>high(TagTypes))) then
                               begin
                               begin
                                 InputError('Symbol index too high');
                                 InputError('Symbol index too high');
                                 exit;
                                 exit;