Commit c3e6e8f0 authored by Diego Biurrun's avatar Diego Biurrun

mem: Do not check unsigned values for negative size

parent b634b36f
......@@ -138,7 +138,7 @@ void *av_realloc(void *ptr, size_t size)
void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
{
if (size <= 0 || nmemb >= INT_MAX / size)
if (!size || nmemb >= INT_MAX / size)
return NULL;
return av_realloc(ptr, nmemb * size);
}
......@@ -147,9 +147,9 @@ int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
{
void **ptrptr = ptr;
void *ret;
if (size <= 0 || nmemb >= INT_MAX / size)
if (!size || nmemb >= INT_MAX / size)
return AVERROR(ENOMEM);
if (nmemb <= 0) {
if (!nmemb) {
av_freep(ptr);
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment