[Bug target/94158] Expanded strlen causes out-of-bounds read on AMD64 target
parker@cyber-itl.org
gcc-bugzilla@gcc.gnu.org
Thu Mar 12 22:38:05 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94158
--- Comment #7 from Parker Thompson <parker@cyber-itl.org> ---
(In reply to Jakub Jelinek from comment #6)
> GCC assumes pointers returned by malloc are at least MALLOC_ABI_ALIGNMENT
> bytes aligned. That is because:
> "The pointer returned if the allocation succeeds is suitably aligned so that
> it may be assigned to a pointer to any type of object and then used to
> access such an object or an array of such objects in the space allocated
> (until the space is explicitly deallocated)."
> glibc normally guarantees 2 * sizeof (void *) alignment, GCC by default
> assumes just a wordsize alignment.
> So, if your malloc replacement doesn't provide such alignment, it is
> incorrect.
Ahhh I see, I apologize for my misunderstanding.
More information about the Gcc-bugs
mailing list