__crt_aligned_alloc_offset(): fix ov_index for backing allocation address

(cherry picked from commit 03a7c36ddb)
This commit is contained in:
Konstantin Belousov 2023-09-06 16:50:27 +03:00
parent 70e76f81e5
commit cbf1bbe5c8

View file

@ -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);
}