瀏覽代碼

+ wasm internal object reader: check that relocations that should point to a SYMTAB_DATA symbol, actually point to such symbol

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

+ 8 - 0
compiler/ogwasm.pas

@@ -2687,6 +2687,14 @@ implementation
                         InputError('Relocation must point to a SYMTAB_FUNCTION symbol');
                         exit;
                       end;
+                    if (RelocType in [
+                          R_WASM_MEMORY_ADDR_LEB,
+                          R_WASM_MEMORY_ADDR_SLEB,
+                          R_WASM_MEMORY_ADDR_I32]) and (SymbolTable[RelocIndex].SymKind<>SYMTAB_DATA) then
+                      begin
+                        InputError('Relocation must point to a SYMTAB_DATA symbol');
+                        exit;
+                      end;
                   end;
               if AReader.Pos<>(SectionStart+SectionSize) then
                 begin