mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
mem: do not check for negative size
size_t is guaranteed to be unsigned Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
parent
4e326ec769
commit
b284e1ffe3
@ -91,7 +91,7 @@ void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
|
||||
*/
|
||||
av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t size)
|
||||
{
|
||||
if (size <= 0 || nmemb >= INT_MAX / size)
|
||||
if (!size || nmemb >= INT_MAX / size)
|
||||
return NULL;
|
||||
return av_malloc(nmemb * size);
|
||||
}
|
||||
@ -204,7 +204,7 @@ void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1);
|
||||
*/
|
||||
av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t size)
|
||||
{
|
||||
if (size <= 0 || nmemb >= INT_MAX / size)
|
||||
if (!size || nmemb >= INT_MAX / size)
|
||||
return NULL;
|
||||
return av_mallocz(nmemb * size);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user