[FFmpeg-devel] [PATCH 1/3] Check for missing reference frames in bink decoder.
Laurent Aimar
fenrir at elivagar.org
Tue Sep 27 23:42:27 CEST 2011
On Tue, Sep 27, 2011 at 03:49:42AM +0200, Michael Niedermayer wrote:
> 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*
I took the easy way ;)
Patch attach.
--
fenrir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Prevent-NULL-dereferences-when-missing-the-reference.patch
Type: text/x-diff
Size: 1621 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110927/b615075f/attachment.bin>
More information about the ffmpeg-devel
mailing list