mem: Do not check unsigned values for negative size

pull/35/head
Diego Biurrun 11 years ago
parent b634b36fce
commit c3e6e8f06c
  1. 6
      libavutil/mem.c

@ -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;
}

Loading…
Cancel
Save