[FFmpeg-cvslog] avrndec: calculate true_height only when used.

Michael Niedermayer git at videolan.org
Tue Nov 13 22:25:46 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Nov 13 22:02:46 2012 +0100| [b1191331363c444c0eaba0055cc7379221ddf8d7] | committer: Michael Niedermayer

avrndec: calculate true_height only when used.

Fixes division by 0

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=b1191331363c444c0eaba0055cc7379221ddf8d7
---

 libavcodec/avrndec.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/avrndec.c b/libavcodec/avrndec.c
index 95c81c8..361b668 100644
--- a/libavcodec/avrndec.c
+++ b/libavcodec/avrndec.c
@@ -78,12 +78,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
     AVFrame *p = &a->frame;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
-    int true_height    = buf_size / (2*avctx->width);
-    int y, ret;
+    int y, ret, true_height;
 
     if(a->is_mjpeg)
         return ff_mjpeg_decode_frame(avctx, data, data_size, avpkt);
 
+    true_height    = buf_size / (2*avctx->width);
     if(p->data[0])
         avctx->release_buffer(avctx, p);
 



More information about the ffmpeg-cvslog mailing list