x86_64: Fix UB on plt rewrite

The elf/tst-plt-rewrite2 and elf/tst-plt-rewrite2 triggers the
failures with ubsan:

UBSAN: Undefined behaviour in ../sysdeps/x86_64/dl-machine.h:637:39 store to misaligned address 0x00007adb50230021 for type 'uint32_t'
This commit is contained in:
Adhemerval Zanella 2025-04-18 09:49:59 -03:00
parent 84c6cfb9b6
commit 8cc687cbac
1 changed files with 1 additions and 1 deletions

View File

@ -633,7 +633,7 @@ x86_64_rewrite_plt (struct link_map *map, ElfW(Addr) plt_rewrite)
/* Write out direct branch. */
*(uint8_t *) branch_start = JMP32_INSN_OPCODE;
*(uint32_t *) (branch_start + 1) = disp;
memcpy ((void *)(branch_start + 1), &disp, sizeof (uint32_t));
}
else
{