[FFmpeg-devel] [PATCH 4/4] lavf/mov: Add support for edit list parsing.

Sasi Inguva isasi at google.com
Mon Sep 19 00:45:52 EEST 2016


Is it ok to just log an error and return 0 ?
On Sep 18, 2016 1:53 PM, "Michael Niedermayer" <michael at niedermayer.cc>
wrote:

> On Sat, Sep 17, 2016 at 03:14:24PM -0700, Sasi Inguva wrote:
> [...]
> > > [...]
> > > > @@ -2756,6 +2757,343 @@ static int mov_read_sbgp(MOVContext *c,
> > > AVIOContext *pb, MOVAtom atom)
> > > >      return pb->eof_reached ? AVERROR_EOF : 0;
> > > >  }
> > > >
> > > > +/**
> > > > + * Get ith edit list entry (media time, duration).
> > > > + */
> > > > +static int get_edit_list_entry(const MOVStreamContext *msc,
> > > > +                               unsigned int edit_list_index,
> > > > +                               int64_t *edit_list_media_time,
> > > > +                               int64_t *edit_list_duration,
> > > > +                               int64_t global_timescale)
> > > > +{
> > > > +    if (edit_list_index == msc->elst_count) {
> > > > +        return 0;
> > > > +    }
> > > > +    *edit_list_media_time = msc->elst_data[edit_list_index].time;
> > > > +    *edit_list_duration = msc->elst_data[edit_list_index].duration;
> > > > +    /* duration is in global timescale units;convert to msc
> timescale */
> > > > +    *edit_list_duration = av_rescale(*edit_list_duration,
> > > msc->time_scale,
> > > > +                                     global_timescale);
> > >
> > > global_timescale can be 0 here leading to division by 0
> > >
> >
> > Added an assert for global_timescale > 0
>
> thats no solution, aborting on random input is not correct
>
> simply trying
> zzuf -cs1:100 ./ffmpeg -i mov_edl_kf_fix_1.mp4 -f null -
>
> triggers the assert at
> Assertion global_timescale > 0 failed at libavformat/mov.c:2777
> zzuf[s=34,r=0.004]: signal 6 (SIGABRT)
>
> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Avoid a single point of failure, be that a person or equipment.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>


More information about the ffmpeg-devel mailing list