Browse Source

+ wasm internal object reader: check that R_WASM_GLOBAL_INDEX_LEB point to a SYMTAB_GLOBAL symbol

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

+ 5 - 0
compiler/ogwasm.pas

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