Browse Source

mem: Do not check unsigned values for negative size

tags/n2.1
Diego Biurrun 12 years ago
parent
commit
c3e6e8f06c
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      libavutil/mem.c

+ 3
- 3
libavutil/mem.c View File

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