On Wed, Jan 20, 2016 at 12:27 PM, Derek Buitenhuis
<derek.buitenh...@gmail.com> wrote:
> This feature is mostly only used by NLE software, and is
> both of dubious value being enabled by default, and a
> possible security risk.
>
> Signed-off-by: Derek Buitenhuis <derek.buitenh...@gmail.com>
> ---
>  libavformat/isom.h    |  1 +
>  libavformat/mov.c     | 20 ++++++++++++++++----
>  libavformat/version.h |  2 +-
>  3 files changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/libavformat/isom.h b/libavformat/isom.h
> index d81d435..aec623b 100644
> --- a/libavformat/isom.h
> +++ b/libavformat/isom.h
> @@ -159,6 +159,7 @@ typedef struct MOVContext {
>      int64_t next_root_atom; ///< offset of the next root atom
>      int export_all;
>      int export_xmp;
> +    int enable_drefs;
>  } MOVContext;
>
>  int ff_mp4_read_descr_len(AVIOContext *pb);
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index aaf1c2d..0a1eefc 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -2484,12 +2484,22 @@ static int mov_read_trak(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>
>      if (sc->dref_id-1 < sc->drefs_count && sc->drefs[sc->dref_id-1].path) {
>          MOVDref *dref = &sc->drefs[sc->dref_id - 1];
> -        if (mov_open_dref(&sc->pb, c->fc->filename, dref, 
> &c->fc->interrupt_callback) < 0)
> -            av_log(c->fc, AV_LOG_ERROR,
> -                   "stream %d, error opening alias: path='%s', dir='%s', "
> -                   "filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d\n",
> +        if (c->enable_drefs) {
> +            if (mov_open_dref(&sc->pb, c->fc->filename, dref, 
> &c->fc->interrupt_callback) < 0)
> +                av_log(c->fc, AV_LOG_ERROR,
> +                       "stream %d, error opening alias: path='%s', dir='%s', 
> "
> +                       "filename='%s', volume='%s', nlvl_from=%d, 
> nlvl_to=%d\n",
> +                       st->index, dref->path, dref->dir, dref->filename,
> +                       dref->volume, dref->nlvl_from, dref->nlvl_to);
> +        } else {
> +            av_log(c->fc, AV_LOG_WARNING,
> +                   "Skipped opening external track: "
> +                   "stream %d, alias: path='%s', dir='%s', "
> +                   "filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d."
> +                   "Set enable_drefs to allow this.\n",
>                     st->index, dref->path, dref->dir, dref->filename,
>                     dref->volume, dref->nlvl_from, dref->nlvl_to);
> +        }
>      } else
>          sc->pb = c->fc->pb;
>
> @@ -3643,6 +3653,8 @@ static const AVOption mov_options[] = {
>          AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = FLAGS },
>      { "export_xmp", "Export full XMP metadata", OFFSET(export_xmp),
>          AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = FLAGS },
> +    { "enable_drefs", "Enable external track support.", OFFSET(enable_drefs),
> +        AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS },

nit: .flags = FLAGS

lgtm
-- 
Vittorio
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to