Commit 3eb6e146 authored by Michael Niedermayer's avatar Michael Niedermayer

zmbv: Fix keyframe fault protextion.

Fixes zzuf -s467 -r0.001 cat samples/zmbv/wc2_001-partial.avi

Bug-found-by: darkshikari
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 7a5eb40e
......@@ -415,6 +415,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
c->flags = buf[0];
buf++; len--;
if(c->flags & ZMBV_KEYFRAME) {
void *decode_intra = NULL;
c->decode_intra= NULL;
hi_ver = buf[0];
lo_ver = buf[1];
c->comp = buf[2];
......@@ -441,29 +443,28 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
switch(c->fmt) {
case ZMBV_FMT_8BPP:
c->bpp = 8;
c->decode_intra = zmbv_decode_intra;
decode_intra = zmbv_decode_intra;
c->decode_xor = zmbv_decode_xor_8;
break;
case ZMBV_FMT_15BPP:
case ZMBV_FMT_16BPP:
c->bpp = 16;
c->decode_intra = zmbv_decode_intra;
decode_intra = zmbv_decode_intra;
c->decode_xor = zmbv_decode_xor_16;
break;
#ifdef ZMBV_ENABLE_24BPP
case ZMBV_FMT_24BPP:
c->bpp = 24;
c->decode_intra = zmbv_decode_intra;
decode_intra = zmbv_decode_intra;
c->decode_xor = zmbv_decode_xor_24;
break;
#endif //ZMBV_ENABLE_24BPP
case ZMBV_FMT_32BPP:
c->bpp = 32;
c->decode_intra = zmbv_decode_intra;
decode_intra = zmbv_decode_intra;
c->decode_xor = zmbv_decode_xor_32;
break;
default:
c->decode_intra = NULL;
c->decode_xor = NULL;
av_log(avctx, AV_LOG_ERROR, "Unsupported (for now) format %i\n", c->fmt);
return -1;
......@@ -479,6 +480,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
c->prev = av_realloc(c->prev, avctx->width * avctx->height * (c->bpp / 8));
c->bx = (c->width + c->bw - 1) / c->bw;
c->by = (c->height+ c->bh - 1) / c->bh;
if(!c->cur || !c->prev)
return -1;
c->decode_intra= decode_intra;
}
if(c->decode_intra == NULL) {
......
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