[FFmpeg-devel] [PATCH]Do not fail for valid PICT files

Michael Niedermayer michaelni at gmx.at
Tue May 19 17:57:12 CEST 2015


On Tue, May 19, 2015 at 10:33:52AM +0200, Carl Eugen Hoyos wrote:
> On Thursday 14 May 2015 01:47:54 pm Michael Niedermayer wrote:
> > On Thu, May 14, 2015 at 12:28:13PM +0200, Carl Eugen Hoyos wrote:
> > > Hi!
> > >
> > > Attached patch fixes reading valid pict files with non-zero user data.
> > > 
> https://developer.apple.com/legacy/library/documentation/mac/QuickDraw/QuickDraw-334.html
> > >
> > > Please comment, Carl Eugen
> > >
> > >  qdrw.c |    5 ++---
> > >  1 file changed, 2 insertions(+), 3 deletions(-)
> > > edf25620818c022655ed281d4e7d614459d56df3  patchqdrw.diff
> > > diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c
> > > index 1c3244b..6ec35c6 100644
> > > --- a/libavcodec/qdrw.c
> > > +++ b/libavcodec/qdrw.c
> > > @@ -124,9 +124,8 @@ static int decode_frame(AVCodecContext *avctx,
> > >      int w, h, ret;
> > >
> > >      bytestream2_init(&gbc, avpkt->data, avpkt->size);
> > > -    while (   bytestream2_get_bytes_left(&gbc) >= 552
> > > -           && (   !AV_RB16(&avpkt->data[bytestream2_tell(&gbc)+6])
> > > -               || !AV_RB16(&avpkt->data[bytestream2_tell(&gbc)+8])))
> > > +    if (   bytestream2_get_bytes_left(&gbc) >= 552
> > > +           && AV_RB32(&avpkt->data[522]) == 0x001102FF)
> >
> > This wont work with files that have a different version
> 
> New patch attached.
> 
> Carl Eugen

>  qdrw.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> a6709bfc86552bd386e843fd6c32c61d28e98f24  patchqdrw.diff
> diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c
> index 0bcf5dc..d88a9f1 100644
> --- a/libavcodec/qdrw.c
> +++ b/libavcodec/qdrw.c
> @@ -153,8 +153,8 @@ static int decode_frame(AVCodecContext *avctx,
>  
>      bytestream2_init(&gbc, avpkt->data, avpkt->size);
>      if (   bytestream2_get_bytes_left(&gbc) >= 552
> -           && !check_header(gbc.buffer      , bytestream2_get_bytes_left(&gbc))
> -           &&  check_header(gbc.buffer + 512, bytestream2_get_bytes_left(&gbc) - 512)
> +        && (   AV_RB32(&avpkt->data[522]) == 0x001102FF
> +            || AV_RB16(&avpkt->data[522]) == 0x1101)

isnt it enough to remove the first !check_header() ?

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150519/2af51c3e/attachment.asc>


More information about the ffmpeg-devel mailing list