summaryrefslogtreecommitdiff
path: root/libavcodec/rv34.c
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2010-03-09 07:14:34 +0000
committerKostya Shishkov <kostya.shishkov@gmail.com>2010-03-09 07:14:34 +0000
commit95bd18eeca4c6f1599d0ca09b37d0e66c82bed8e (patch)
treecac8b812e18622c929096c19e24568a6df2f95d2 /libavcodec/rv34.c
parentd63a7187646c07619ecb07a3d4bb67c7fba5500d (diff)
Check for reference frames so RV 3/4 won't segfault trying to copy data from
nonexisting reference. Originally committed as revision 22378 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/rv34.c')
-rw-r--r--libavcodec/rv34.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 50ded79977..1100fbd244 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1452,8 +1452,12 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
av_log(avctx, AV_LOG_ERROR, "First slice header is incorrect\n");
return -1;
}
+ if((!s->last_picture_ptr || !s->last_picture_ptr->data[0]) && si.type == FF_P_TYPE)
+ return -1;
if((!s->last_picture_ptr || !s->last_picture_ptr->data[0]) && si.type == FF_B_TYPE)
return -1;
+ if((!s->next_picture_ptr || !s->next_picture_ptr->data[0]) && si.type == FF_B_TYPE)
+ return -1;
/* skip b frames if we are in a hurry */
if(avctx->hurry_up && si.type==FF_B_TYPE) return buf_size;
if( (avctx->skip_frame >= AVDISCARD_NONREF && si.type==FF_B_TYPE)