Commit b1191331 authored by Michael Niedermayer's avatar Michael Niedermayer

avrndec: calculate true_height only when used.

Fixes division by 0

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 7373b3ad
...@@ -78,12 +78,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac ...@@ -78,12 +78,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
AVFrame *p = &a->frame; AVFrame *p = &a->frame;
const uint8_t *buf = avpkt->data; const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size; int buf_size = avpkt->size;
int true_height = buf_size / (2*avctx->width); int y, ret, true_height;
int y, ret;
if(a->is_mjpeg) if(a->is_mjpeg)
return ff_mjpeg_decode_frame(avctx, data, data_size, avpkt); return ff_mjpeg_decode_frame(avctx, data, data_size, avpkt);
true_height = buf_size / (2*avctx->width);
if(p->data[0]) if(p->data[0])
avctx->release_buffer(avctx, p); avctx->release_buffer(avctx, p);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment