https://bugs.kde.org/show_bug.cgi?id=475498

--- Comment #1 from Paul Floyd <pjfl...@wanadoo.fr> ---
Also adding a wrapper will slightly improve error messages.

The FreeBSD implementation is

void *
reallocarray(void *optr, size_t nmemb, size_t size)
{

        if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
            nmemb > 0 && SIZE_MAX / nmemb < size) {
                errno = ENOMEM;
                return (NULL);
        }
        return (realloc(optr, size * nmemb));
}

Illumos uses the same source (from OpenBSD)

musl and GNU libc do the same thing but without the square root of MAX_SIZE
checks to avoid the division.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to