[FFmpeg-cvslog] lavu/mem: Do not realloc in av_fast_realloc() if size == min_size.
Carl Eugen Hoyos
git at videolan.org
Mon Jan 1 23:30:37 EET 2018
ffmpeg | branch: master | Carl Eugen Hoyos <ceffmpeg at gmail.com> | Sat Dec 30 14:38:33 2017 +0100| [21b5990da461e4f83cf53994715ed42e22cce9e0] | committer: 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.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=21b5990da461e4f83cf53994715ed42e22cce9e0
---
libavutil/mem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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);
More information about the ffmpeg-cvslog
mailing list