Open
Description
Hello,
I noticed this in mimalloc 1.7.6:
static void* mi_heap_realloc_zero_aligned(mi_heap_t* heap, void* p, size_t newsize, size_t alignment, bool zero) mi_attr_noexcept {
mi_assert(alignment > 0);
if (alignment <= sizeof(uintptr_t)) return _mi_heap_realloc_zero(heap,p,newsize,zero);
size_t offset = ((uintptr_t)p % alignment); // use offset of previous allocation (p can be NULL)
return mi_heap_realloc_zero_aligned_at(heap,p,newsize,alignment,offset,zero);
}
However, if the previously allocated ptr did not use any alignment constraint, we use an unwanted offset when allocating the new block and thus return a value which is not correctly aligned.
Is that intentional?
Metadata
Metadata
Assignees
Labels
No labels