[FFmpeg-cvslog] avcodec/utils: Fix potential overflow in overallocation code

Michael Niedermayer git at videolan.org
Sat Jul 11 23:44:39 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Jul 11 22:46:44 2015 +0200| [bc976e5793004c9e4bdedf160852db9bc8b2dcaf] | committer: Michael Niedermayer

avcodec/utils: Fix potential overflow in overallocation code

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bc976e5793004c9e4bdedf160852db9bc8b2dcaf
---

 libavcodec/utils.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 4245b1a..0910fca 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -127,7 +127,7 @@ static inline int ff_fast_malloc(void *ptr, unsigned int *size, size_t min_size,
     void **p = ptr;
     if (min_size <= *size && *p)
         return 0;
-    min_size = FFMAX(17 * min_size / 16 + 32, min_size);
+    min_size = FFMAX(min_size + min_size / 16 + 32, min_size);
     av_free(*p);
     *p = zero_realloc ? av_mallocz(min_size) : av_malloc(min_size);
     if (!*p)



More information about the ffmpeg-cvslog mailing list