lavu/mem: Do not realloc in av_fast_realloc() if size == min_size.

This can avoid OOM for min_size close to FFmpeg's arbitrary alloc limits.
This commit is contained in:
Carl Eugen Hoyos 2017-12-30 14:38:33 +01:00
parent 1112ba012d
commit 21b5990da4

View File

@ -463,7 +463,7 @@ void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
{
if (min_size < *size)
if (min_size <= *size)
return ptr;
min_size = FFMAX(min_size + min_size / 16 + 32, min_size);