Commit b9551e71 authored by Derek Buitenhuis's avatar Derek Buitenhuis Committed by Michael Niedermayer

mov: Add an option to toggle dref opening

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: 's avatarDerek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 712d962a)

Conflicts:

	libavformat/isom.h
	libavformat/mov.c
	libavformat/version.h
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 828d85bf
...@@ -209,6 +209,7 @@ typedef struct MOVContext { ...@@ -209,6 +209,7 @@ typedef struct MOVContext {
void *audible_fixed_key; void *audible_fixed_key;
int audible_fixed_key_size; int audible_fixed_key_size;
struct AVAES *aes_decrypt; struct AVAES *aes_decrypt;
int enable_drefs;
} MOVContext; } MOVContext;
int ff_mp4_read_descr_len(AVIOContext *pb); int ff_mp4_read_descr_len(AVIOContext *pb);
......
...@@ -3002,13 +3002,23 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -3002,13 +3002,23 @@ 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) { if (sc->dref_id-1 < sc->drefs_count && sc->drefs[sc->dref_id-1].path) {
MOVDref *dref = &sc->drefs[sc->dref_id - 1]; MOVDref *dref = &sc->drefs[sc->dref_id - 1];
if (mov_open_dref(c, &sc->pb, c->fc->filename, dref, if (c->enable_drefs) {
&c->fc->interrupt_callback) < 0) if (mov_open_dref(c, &sc->pb, c->fc->filename, dref,
av_log(c->fc, AV_LOG_ERROR, &c->fc->interrupt_callback) < 0)
"stream %d, error opening alias: path='%s', dir='%s', " av_log(c->fc, AV_LOG_ERROR,
"filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d\n", "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, st->index, dref->path, dref->dir, dref->filename,
dref->volume, dref->nlvl_from, dref->nlvl_to); dref->volume, dref->nlvl_from, dref->nlvl_to);
}
} else { } else {
sc->pb = c->fc->pb; sc->pb = c->fc->pb;
sc->pb_is_copied = 1; sc->pb_is_copied = 1;
...@@ -4925,6 +4935,8 @@ static const AVOption mov_options[] = { ...@@ -4925,6 +4935,8 @@ static const AVOption mov_options[] = {
"Fixed key used for handling Audible AAX files", OFFSET(audible_fixed_key), "Fixed key used for handling Audible AAX files", OFFSET(audible_fixed_key),
AV_OPT_TYPE_BINARY, {.str="77214d4b196a87cd520045fd20a51d67"}, AV_OPT_TYPE_BINARY, {.str="77214d4b196a87cd520045fd20a51d67"},
.flags = AV_OPT_FLAG_DECODING_PARAM }, .flags = AV_OPT_FLAG_DECODING_PARAM },
{ "enable_drefs", "Enable external track support.", OFFSET(enable_drefs), AV_OPT_TYPE_INT,
{.i64 = 0}, 0, 1, FLAGS },
{ NULL }, { NULL },
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment