Commit 21b5990d authored by Carl Eugen Hoyos's avatar Carl Eugen Hoyos

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.
parent 1112ba01
...@@ -463,7 +463,7 @@ void av_memcpy_backptr(uint8_t *dst, int back, int cnt) ...@@ -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) void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
{ {
if (min_size < *size) if (min_size <= *size)
return ptr; return ptr;
min_size = FFMAX(min_size + min_size / 16 + 32, min_size); min_size = FFMAX(min_size + min_size / 16 + 32, min_size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment