mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-12 18:18:07 +00:00
solve #134
This commit is contained in:
@ -340,7 +340,7 @@ void* realloc(void* ptr, size_t len) {
|
|||||||
|
|
||||||
int posix_memalign(void** ptr, size_t align, size_t len) {
|
int posix_memalign(void** ptr, size_t align, size_t len) {
|
||||||
|
|
||||||
if (*ptr == NULL) return EINVAL;
|
// if (*ptr == NULL) return EINVAL; // (andrea) Why? I comment it out for now
|
||||||
if ((align % 2) || (align % sizeof(void*))) return EINVAL;
|
if ((align % 2) || (align % sizeof(void*))) return EINVAL;
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
|
|
||||||
@ -349,11 +349,14 @@ int posix_memalign(void** ptr, size_t align, size_t len) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (align >= 4 * sizeof(size_t)) len += align - 1;
|
size_t rem = len % align;
|
||||||
|
if (rem) len += align - rem;
|
||||||
|
|
||||||
*ptr = malloc(len);
|
*ptr = __dislocator_alloc(len);
|
||||||
|
|
||||||
DEBUGF("posix_memalign(%p %zu, %zu)", ptr, align, len);
|
if (*ptr && len) memset(*ptr, ALLOC_CLOBBER, len);
|
||||||
|
|
||||||
|
DEBUGF("posix_memalign(%p %zu, %zu) [*ptr = %p]", ptr, align, len, *ptr);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user