Hi

On Thu, Mar 26, 2026 at 02:37:18AM +0100, Michael Niedermayer via ffmpeg-devel 
wrote:
[...]
> > +
> > +    return 0;
> > +}
> > +
> >  static int decode_text_chunk(PNGDecContext *s, GetByteContext *gb, int 
> > compressed)
> >  {
> >      int ret, method;
> > @@ -582,6 +677,17 @@ static int decode_text_chunk(PNGDecContext *s, 
> > GetByteContext *gb, int compresse
> >          return AVERROR(ENOMEM);
> >      }
> >  
> > +    if (!strcmp(kw_utf8, "Raw profile type exif")) {
> > +        ret = decode_text_to_exif(s, txt_utf8);
> > +        if (ret < 0) {;
> > +            av_buffer_unref(&s->exif_data);
> > +        } else {
> > +            av_freep(&kw_utf8);
> > +            av_freep(&txt_utf8);
> > +            return ret;
> > +        }
> > +    }
> > +
> >      av_dict_set(&s->frame_metadata, kw_utf8, txt_utf8,
> >                  AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
> >      return 0;
> 
> > @@ -654,6 +760,23 @@ static int decode_phys_chunk(AVCodecContext *avctx, 
> > PNGDecContext *s,
> >      return 0;
> >  }
> >  
> > +static int decode_exif_chunk(AVCodecContext *avctx, PNGDecContext *s,
> > +                             GetByteContext *gb)
> > +{
> > +    if (!(s->hdr_state & PNG_IHDR)) {
> > +        av_log(avctx, AV_LOG_ERROR, "eXIf before IHDR\n");
> > +        return AVERROR_INVALIDDATA;
> > +    }
> 
> This should check that there is only one eXIf and that its after IDAT as 
> required by the spec
> (the code could ask for samples if there are multiple exif)

as noticed on IRC, eXIf should be before IDAT. But to be as flexible as possible
and support as many odd files as possible its better not to fail if that spec
requiement is not met.

What remains from this one is multiple eXIf which the spec does not allow and 
the code does not
support and thus should check for

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Observe your enemies, for they first find out your faults. -- Antisthenes

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to