Commit bc185f72 authored by Reimar Döffinger's avatar Reimar Döffinger

Do not crash when the first frame is not a keyframe (and thus none of the

necessary initialization has been done yet).

Originally committed as revision 5815 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 22ffac70
...@@ -2235,10 +2235,15 @@ static int vp3_decode_frame(AVCodecContext *avctx, ...@@ -2235,10 +2235,15 @@ static int vp3_decode_frame(AVCodecContext *avctx,
vp3_calculate_pixel_addresses(s); vp3_calculate_pixel_addresses(s);
else else
theora_calculate_pixel_addresses(s); theora_calculate_pixel_addresses(s);
s->pixel_addresses_inited = 1;
} }
} else { } else {
/* allocate a new current frame */ /* allocate a new current frame */
s->current_frame.reference = 3; s->current_frame.reference = 3;
if (!s->pixel_addresses_inited) {
av_log(s->avctx, AV_LOG_ERROR, "vp3: first frame not a keyframe\n");
return -1;
}
if(avctx->get_buffer(avctx, &s->current_frame) < 0) { if(avctx->get_buffer(avctx, &s->current_frame) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "vp3: get_buffer() failed\n"); av_log(s->avctx, AV_LOG_ERROR, "vp3: get_buffer() failed\n");
return -1; return -1;
......
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