Quoting Vittorio Giovara (2015-09-26 16:22:01)
> From: Michael Niedermayer <[email protected]>
> 
> Failing earlier causes the context to be insufficiently initialized
> which can break decoding future frames with threads.
> 
> Signed-off-by: Michael Niedermayer <[email protected]>
> ---
>  libavcodec/rv34.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
> index 6c0a4a3..c09c8f7 100644
> --- a/libavcodec/rv34.c
> +++ b/libavcodec/rv34.c
> @@ -1617,6 +1617,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) {
> @@ -1654,7 +1655,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)
> @@ -1738,6 +1739,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);
> -- 
> 1.9.5 (Apple Git-50.3)

This looks rather fragile. I think it'd be better to do what other
decoders do in this case -- generate a dummy reference.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to