git: 17922d7028d9 - releng/14.0 - __crt_aligned_alloc_offset(): fix ov_index for backing allocation address

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sat, 09 Sep 2023 11:40:59 UTC
The branch releng/14.0 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=17922d7028d9ba4e6ea68243a79bee3008abbe1e

commit 17922d7028d9ba4e6ea68243a79bee3008abbe1e
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-09-06 13:50:27 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-09-09 11:40:24 +0000

    __crt_aligned_alloc_offset(): fix ov_index for backing allocation address
    
    Approved by:    re (gjb)
    
    (cherry picked from commit 03a7c36ddbc0ddb1063d2c8a37c64d83e1519c55)
    (cherry picked from commit cbf1bbe5c8b5afedff247dbc20f4bccd888a06e9)
---
 libexec/rtld-elf/rtld_malloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libexec/rtld-elf/rtld_malloc.c b/libexec/rtld-elf/rtld_malloc.c
index 6e011e88ba5a..4b5140551675 100644
--- a/libexec/rtld-elf/rtld_malloc.c
+++ b/libexec/rtld-elf/rtld_malloc.c
@@ -188,7 +188,7 @@ __crt_aligned_alloc_offset(size_t align, size_t size, size_t offset)
 	x += offset;
 	ov = cp2op((void *)x);
 	ov1.ov_magic = AMAGIC;
-	ov1.ov_index = x - (uintptr_t)mem - sizeof(union overhead);
+	ov1.ov_index = x - (uintptr_t)mem + sizeof(union overhead);
 	memcpy(ov, &ov1, sizeof(ov1));
 	return ((void *)x);
 }