diff options
author | Carl Eugen Hoyos <ceffmpeg@gmail.com> | 2017-12-30 14:38:33 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <ceffmpeg@gmail.com> | 2018-01-01 22:30:22 +0100 |
commit | 21b5990da461e4f83cf53994715ed42e22cce9e0 (patch) | |
tree | dd5988a0cce72b6a1a09344a0ea6cf23b2ce481f | |
parent | 1112ba012df38d486694154b03f5007341f43b24 (diff) | |
download | ffmpeg-21b5990da461e4f83cf53994715ed42e22cce9e0.tar.gz |
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.
-rw-r--r-- | libavutil/mem.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavutil/mem.c b/libavutil/mem.c index 79e8b597f1..0729e1dd50 100644 --- a/libavutil/mem.c +++ b/libavutil/mem.c @@ -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); |