You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-16 22:42:38 +02:00
zmbv: Fix keyframe fault protextion.
Fixes zzuf -s467 -r0.001 cat samples/zmbv/wc2_001-partial.avi Bug-found-by: darkshikari Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@ -415,6 +415,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
|
|||||||
c->flags = buf[0];
|
c->flags = buf[0];
|
||||||
buf++; len--;
|
buf++; len--;
|
||||||
if(c->flags & ZMBV_KEYFRAME) {
|
if(c->flags & ZMBV_KEYFRAME) {
|
||||||
|
void *decode_intra = NULL;
|
||||||
|
c->decode_intra= NULL;
|
||||||
hi_ver = buf[0];
|
hi_ver = buf[0];
|
||||||
lo_ver = buf[1];
|
lo_ver = buf[1];
|
||||||
c->comp = buf[2];
|
c->comp = buf[2];
|
||||||
@ -441,29 +443,28 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
|
|||||||
switch(c->fmt) {
|
switch(c->fmt) {
|
||||||
case ZMBV_FMT_8BPP:
|
case ZMBV_FMT_8BPP:
|
||||||
c->bpp = 8;
|
c->bpp = 8;
|
||||||
c->decode_intra = zmbv_decode_intra;
|
decode_intra = zmbv_decode_intra;
|
||||||
c->decode_xor = zmbv_decode_xor_8;
|
c->decode_xor = zmbv_decode_xor_8;
|
||||||
break;
|
break;
|
||||||
case ZMBV_FMT_15BPP:
|
case ZMBV_FMT_15BPP:
|
||||||
case ZMBV_FMT_16BPP:
|
case ZMBV_FMT_16BPP:
|
||||||
c->bpp = 16;
|
c->bpp = 16;
|
||||||
c->decode_intra = zmbv_decode_intra;
|
decode_intra = zmbv_decode_intra;
|
||||||
c->decode_xor = zmbv_decode_xor_16;
|
c->decode_xor = zmbv_decode_xor_16;
|
||||||
break;
|
break;
|
||||||
#ifdef ZMBV_ENABLE_24BPP
|
#ifdef ZMBV_ENABLE_24BPP
|
||||||
case ZMBV_FMT_24BPP:
|
case ZMBV_FMT_24BPP:
|
||||||
c->bpp = 24;
|
c->bpp = 24;
|
||||||
c->decode_intra = zmbv_decode_intra;
|
decode_intra = zmbv_decode_intra;
|
||||||
c->decode_xor = zmbv_decode_xor_24;
|
c->decode_xor = zmbv_decode_xor_24;
|
||||||
break;
|
break;
|
||||||
#endif //ZMBV_ENABLE_24BPP
|
#endif //ZMBV_ENABLE_24BPP
|
||||||
case ZMBV_FMT_32BPP:
|
case ZMBV_FMT_32BPP:
|
||||||
c->bpp = 32;
|
c->bpp = 32;
|
||||||
c->decode_intra = zmbv_decode_intra;
|
decode_intra = zmbv_decode_intra;
|
||||||
c->decode_xor = zmbv_decode_xor_32;
|
c->decode_xor = zmbv_decode_xor_32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
c->decode_intra = NULL;
|
|
||||||
c->decode_xor = NULL;
|
c->decode_xor = NULL;
|
||||||
av_log(avctx, AV_LOG_ERROR, "Unsupported (for now) format %i\n", c->fmt);
|
av_log(avctx, AV_LOG_ERROR, "Unsupported (for now) format %i\n", c->fmt);
|
||||||
return -1;
|
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->prev = av_realloc(c->prev, avctx->width * avctx->height * (c->bpp / 8));
|
||||||
c->bx = (c->width + c->bw - 1) / c->bw;
|
c->bx = (c->width + c->bw - 1) / c->bw;
|
||||||
c->by = (c->height+ c->bh - 1) / c->bh;
|
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) {
|
if(c->decode_intra == NULL) {
|
||||||
|
Reference in New Issue
Block a user