aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/rv34.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-09-16 23:52:51 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-09-17 02:08:15 +0200
commitfa5358f07d0cda461ee3c2d63e438a69ef00ca2f (patch)
tree09acd69b111dab549961df5800a3a2e39c2d3280 /libavcodec/rv34.c
parent80d23d9d32d0a310f85d9623337d8681be080aa8 (diff)
downloadffmpeg-fa5358f07d0cda461ee3c2d63e438a69ef00ca2f.tar.gz
avcodec/rv34: Delay failure return for B frames with a missing reference
Failing earlier causes the context to be insufficiently initialized which can break decoding future frames with threads Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/rv34.c')
-rw-r--r--libavcodec/rv34.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 51e0f4014f..c2e84a3b57 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1645,6 +1645,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
int slice_count;
const uint8_t *slices_hdr = NULL;
int last = 0;
+ int faulty_b = 0;
/* no supplementary picture */
if (buf_size == 0) {
@@ -1682,7 +1683,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
si.type == AV_PICTURE_TYPE_B) {
av_log(avctx, AV_LOG_ERROR, "Invalid decoder state: B-frame without "
"reference data.\n");
- return AVERROR_INVALIDDATA;
+ faulty_b = 1;
}
if( (avctx->skip_frame >= AVDISCARD_NONREF && si.type==AV_PICTURE_TYPE_B)
|| (avctx->skip_frame >= AVDISCARD_NONKEY && si.type!=AV_PICTURE_TYPE_I)
@@ -1772,6 +1773,8 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
"multithreading mode (start MB is %d).\n", si.start);
return AVERROR_INVALIDDATA;
}
+ if (faulty_b)
+ return AVERROR_INVALIDDATA;
for(i = 0; i < slice_count; i++){
int offset = get_slice_offset(avctx, slices_hdr, i);