[FFmpeg-cvslog] eacmv: Free frames on resolution changes

Michael Niedermayer git at videolan.org
Fri Jan 25 03:44:23 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Jan 25 00:41:16 2013 +0100| [e9d443cf08503f7bd0149576ba9e891322de340d] | committer: Michael Niedermayer

eacmv: Free frames on resolution changes

Fixes out of array reads

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/eacmv.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c
index a129161..33c6145 100644
--- a/libavcodec/eacmv.c
+++ b/libavcodec/eacmv.c
@@ -132,8 +132,13 @@ static void cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t
 
     s->width  = AV_RL16(&buf[4]);
     s->height = AV_RL16(&buf[6]);
-    if (s->avctx->width!=s->width || s->avctx->height!=s->height)
+    if (s->avctx->width!=s->width || s->avctx->height!=s->height) {
         avcodec_set_dimensions(s->avctx, s->width, s->height);
+        if (s->frame.data[0])
+            s->avctx->release_buffer(s->avctx, &s->frame);
+        if (s->last_frame.data[0])
+            s->avctx->release_buffer(s->avctx, &s->last_frame);
+    }
 
     s->avctx->time_base.num = 1;
     s->avctx->time_base.den = AV_RL16(&buf[10]);



More information about the ffmpeg-cvslog mailing list