[FFmpeg-devel] [PATCH] libavformat/flac_picture: Don't return AVERROR_INVALIDDATA for errors with flac picture mimetype

Anton Khirnov anton at khirnov.net
Wed Sep 28 17:17:17 EEST 2022


Quoting James Almer (2022-09-10 03:16:32)
> On 9/9/2022 7:44 PM, Will Cassella wrote:
> > In the case where the FLAC picture MIME type is not understood, fail to
> > parse the picture silently rather than return AVERROR_INVALIDDATA.
> > 
> > This originated from a bug reported in Chromium: https://crbug.com/1052821
> > 
> > Signed-off-by: Will Cassella <cassew at google.com>
> > ---
> >   libavformat/flac_picture.c | 4 ----
> >   1 file changed, 4 deletions(-)
> > 
> > diff --git a/libavformat/flac_picture.c b/libavformat/flac_picture.c
> > index b33fee75b4..1acad9b251 100644
> > --- a/libavformat/flac_picture.c
> > +++ b/libavformat/flac_picture.c
> > @@ -68,8 +68,6 @@ int ff_flac_parse_picture(AVFormatContext *s,
> > uint8_t **bufp, int buf_size,
> >       if (len <= 0 || len >= sizeof(mimetype)) {
> >           av_log(s, AV_LOG_ERROR, "Could not read mimetype from an attached "
> >                  "picture.\n");
> > -        if (s->error_recognition & AV_EF_EXPLODE)
> > -            return AVERROR_INVALIDDATA;
> 
> If you don't want to error out, then don't enable explode mode, which is 
> meant to abort on the slightest issue?

IMO failing to recognize the MIME type is a lavf error rather than a
file error and so should not fail, much less with AVERROR_INVALIDDATA
(should be ENOSYS if anything).

THe other error should stay though - then the file actually is broken.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list