[FFmpeg-cvslog] avcodec/utils: Clear dimensions in ff_get_buffer() on failure

Michael Niedermayer git at videolan.org
Sun Dec 6 02:26:08 CET 2015


ffmpeg | branch: release/2.5 | Michael Niedermayer <michael at niedermayer.cc> | Sat Nov 28 20:08:46 2015 +0100| [e5d162ae9bd59711cd945c7b4b3dc85d896208bb] | committer: Michael Niedermayer

avcodec/utils: Clear dimensions in ff_get_buffer() on failure

Fixes out of array access
Fixes: 482d8f2fd17c9f532b586458a33f267c/asan_heap-oob_4a52b6_7417_1d08d477736d66cdadd833d146bb8bae.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit abee0a1c60612e8638640a8a3738fffb65e16dbf)

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

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

 libavcodec/utils.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 7deb777a..e70c464 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1028,8 +1028,10 @@ end:
 int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
 {
     int ret = get_buffer_internal(avctx, frame, flags);
-    if (ret < 0)
+    if (ret < 0) {
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+        frame->width = frame->height = 0;
+    }
     return ret;
 }
 



More information about the ffmpeg-cvslog mailing list