summaryrefslogtreecommitdiff
path: root/libavcodec/avrndec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-13 22:02:46 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-11-13 22:03:21 +0100
commitb1191331363c444c0eaba0055cc7379221ddf8d7 (patch)
tree6347f484584a55e34bdd5af71574112e1dd7643c /libavcodec/avrndec.c
parent7373b3ad043cc3417d80c55ccdb620b08cd271bf (diff)
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@gmx.at>
Diffstat (limited to 'libavcodec/avrndec.c')
-rw-r--r--libavcodec/avrndec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/avrndec.c b/libavcodec/avrndec.c
index 95c81c8142..361b6683d4 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);