master
 1#include <stdlib.h>
 2#include <errno.h>
 3
 4void *__reallocarray(void *ptr, size_t nmemb, size_t size) {
 5    size_t bytes;
 6    if (__builtin_umull_overflow(nmemb, size, &bytes)) {
 7        errno = ENOMEM;
 8        return NULL;
 9    }
10    return realloc(ptr, bytes);
11}
12
13void *reallocarray(void *ptr, size_t nmemb, size_t size)
14    __attribute__((__weak__, __alias__("__reallocarray")));