Browse Source

* wasm internal object reader: validate that R_WASM_TAG_INDEX_LEB relocations point to a SYMTAB_EVENT symbol

Nikolay Nikolov 1 year ago
parent
commit
3121f3f8a0
1 changed files with 5 additions and 0 deletions
  1. 5 0
      compiler/ogwasm.pas

+ 5 - 0
compiler/ogwasm.pas

@@ -2697,6 +2697,11 @@ implementation
                         InputError('Relocation must point to a SYMTAB_GLOBAL symbol');
                         exit;
                       end;
+                    if (RelocType=R_WASM_TAG_INDEX_LEB) and (SymbolTable[RelocIndex].SymKind<>SYMTAB_EVENT) then
+                      begin
+                        InputError('Relocation must point to a SYMTAB_EVENT symbol');
+                        exit;
+                      end;
                     if (RelocType in [
                           R_WASM_FUNCTION_INDEX_LEB,
                           R_WASM_TABLE_INDEX_SLEB,