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>
This commit is contained in:
Michael Niedermayer 2012-11-13 22:02:46 +01:00
parent 7373b3ad04
commit b119133136
1 changed files with 2 additions and 2 deletions

View File

@ -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);