[FFmpeg-devel] [PATCH 1/3] Check for missing reference frames in bink decoder.

Michael Niedermayer michaelni at gmx.at
Tue Sep 27 03:49:42 CEST 2011


On Tue, Sep 27, 2011 at 01:02:15AM +0200, fenrir at elivagar.org wrote:
> From: Laurent Aimar <fenrir at videolan.org>
> 
> ---
>  libavcodec/bink.c |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
> 
> diff --git a/libavcodec/bink.c b/libavcodec/bink.c
> index e137312..045cd46 100644
> --- a/libavcodec/bink.c
> +++ b/libavcodec/bink.c
> @@ -992,6 +992,10 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx,
>              }
>              switch (blk) {
>              case SKIP_BLOCK:
> +                if (!c->last.data[0]) {
> +                    av_log(c->avctx, AV_LOG_ERROR, "Missing reference frame\n");
> +                    return -1;
> +                }
>                  c->dsp.put_pixels_tab[1][0](dst, prev, stride, 8);
>                  break;
>              case SCALED_BLOCK:
> @@ -1055,6 +1059,10 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx,
>                  prev += 8;
>                  break;
>              case MOTION_BLOCK:
> +                if (!c->last.data[0]) {
> +                    av_log(c->avctx, AV_LOG_ERROR, "Missing reference frame\n");
> +                    return -1;
> +                }
>                  xoff = get_value(c, BINK_SRC_X_OFF);
>                  yoff = get_value(c, BINK_SRC_Y_OFF);
>                  ref = prev + xoff + yoff * stride;

I think its better to skip the block and continue instead of aborting
This would allow partially decoding the frame unless i miss something

Another, maybe easier alternative would be allocating a dummy frame
or asigning the current frame to last*


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110927/e06e3073/attachment.asc>


More information about the ffmpeg-devel mailing list