diff mbox series

[FFmpeg-devel] avformat/mov: Ignore duplicate ftyp

Message ID 20231201232603.31423-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel] avformat/mov: Ignore duplicate ftyp | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer Dec. 1, 2023, 11:26 p.m. UTC
Fixes: switch_1080p_720p.mp4
Found-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mov.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Marvin Scholz Dec. 1, 2023, 11:59 p.m. UTC | #1
On 2 Dec 2023, at 0:26, Michael Niedermayer wrote:

> Fixes: switch_1080p_720p.mp4
> Found-by: Dale Curtis <dalecurtis@chromium.org>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mov.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index f7b5ec7a352..fb5d6f49138 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -1222,8 +1222,10 @@ static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>      int ret = ffio_read_size(pb, type, 4);
>      if (ret < 0)
>          return ret;
> -    if (c->fc->nb_streams)
> -        return AVERROR_INVALIDDATA;
> +    if (c->fc->nb_streams) {
> +        av_log(c->fc, AV_LOG_DEBUG, "Ignoring duplicate FTYP\n");
> +        return 0;
> +    }
>

Should this be an error when FF_COMPLIANCE_STRICT maybe?

>      if (strcmp(type, "qt  "))
>          c->isom = 1;
> -- 
> 2.17.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Dale Curtis Dec. 4, 2023, 6:05 p.m. UTC | #2
Thanks! lgtm, defer to you on FF_COMPLIANCE_STRICT.

On Fri, Dec 1, 2023 at 3:59 PM <epirat07@gmail.com> wrote:

>
>
> On 2 Dec 2023, at 0:26, Michael Niedermayer wrote:
>
> > Fixes: switch_1080p_720p.mp4
> > Found-by: Dale Curtis <dalecurtis@chromium.org>
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavformat/mov.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavformat/mov.c b/libavformat/mov.c
> > index f7b5ec7a352..fb5d6f49138 100644
> > --- a/libavformat/mov.c
> > +++ b/libavformat/mov.c
> > @@ -1222,8 +1222,10 @@ static int mov_read_ftyp(MOVContext *c,
> AVIOContext *pb, MOVAtom atom)
> >      int ret = ffio_read_size(pb, type, 4);
> >      if (ret < 0)
> >          return ret;
> > -    if (c->fc->nb_streams)
> > -        return AVERROR_INVALIDDATA;
> > +    if (c->fc->nb_streams) {
> > +        av_log(c->fc, AV_LOG_DEBUG, "Ignoring duplicate FTYP\n");
> > +        return 0;
> > +    }
> >
>
> Should this be an error when FF_COMPLIANCE_STRICT maybe?
>
> >      if (strcmp(type, "qt  "))
> >          c->isom = 1;
> > --
> > 2.17.1
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
Michael Niedermayer Dec. 5, 2023, 11:13 a.m. UTC | #3
On Mon, Dec 04, 2023 at 10:05:43AM -0800, Dale Curtis wrote:
> Thanks! lgtm, defer to you on FF_COMPLIANCE_STRICT.

applied with FF_COMPLIANCE_STRICT check

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index f7b5ec7a352..fb5d6f49138 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1222,8 +1222,10 @@  static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     int ret = ffio_read_size(pb, type, 4);
     if (ret < 0)
         return ret;
-    if (c->fc->nb_streams)
-        return AVERROR_INVALIDDATA;
+    if (c->fc->nb_streams) {
+        av_log(c->fc, AV_LOG_DEBUG, "Ignoring duplicate FTYP\n");
+        return 0;
+    }
 
     if (strcmp(type, "qt  "))
         c->isom = 1;