Resolve bug when using unusual MALLOC_ALIGNMENT
commit440e6c1197636a1dc0ae413fca815254a71d2a27
authorEyal Itkin <eyal.itkin@gmail.com>
Mon, 30 Mar 2020 18:32:35 +0000 (30 21:32 +0300)
committerWaldemar Brodkorb <wbx@openadk.org>
Wed, 1 Apr 2020 19:43:28 +0000 (1 21:43 +0200)
tree31f6a8ef3c77e528bccd53495c248d152e08bf82
parent6f7c6883b72134d1ae28a6223ab9c9738d033867
Resolve bug when using unusual MALLOC_ALIGNMENT

Safe-Linking alignment checks should be done on the user's buffer and not
the mchunkptr. The new check adds support for cases in which:
MALLOC_ALIGNMENT != 2*(sizeof(size_t))

The default case for both 32 bits and 64 bits was already supported, and
this patch adds support for the described irregular case.
libc/stdlib/malloc-standard/malloc.h