mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-30 15:00:29 +00:00
mem: Do not check unsigned values for negative size
This commit is contained in:
parent
b634b36fce
commit
c3e6e8f06c
@ -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…
Reference in New Issue
Block a user