diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-02-10 14:40:32 +0000 |
---|---|---|
committer | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-02-10 14:42:41 +0000 |
commit | bc9a5965c815cf7fd998d8ce14a18b8e861dd9ce (patch) | |
tree | 7011642746984633573c9a2d993d58dfd12ee44b /libavformat/mov.c | |
parent | d94b11a721385aa406187da8f49380f29be0fa7e (diff) | |
parent | 9f61abc8111c7c43f49ca012e957a108b9cc7610 (diff) | |
download | ffmpeg-bc9a5965c815cf7fd998d8ce14a18b8e861dd9ce.tar.gz |
Merge commit '9f61abc8111c7c43f49ca012e957a108b9cc7610'
This also deprecates our old duplicated callbacks.
* commit '9f61abc8111c7c43f49ca012e957a108b9cc7610':
lavf: allow custom IO for all files
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r-- | libavformat/mov.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 299bee6f29..149e3b4a0e 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2922,14 +2922,8 @@ static int test_same_origin(const char *src, const char *ref) { return 1; } -static int mov_open_dref(MOVContext *c, AVIOContext **pb, const char *src, MOVDref *ref, - AVIOInterruptCB *int_cb) +static int mov_open_dref(MOVContext *c, AVIOContext **pb, const char *src, MOVDref *ref) { - AVOpenCallback open_func = c->fc->open_cb; - - if (!open_func) - open_func = ffio_open2_wrapper; - /* try relative path, we do not try the absolute because it can leak information about our system to an attacker */ if (ref->nlvl_to > 0 && ref->nlvl_from > 0) { @@ -2962,7 +2956,7 @@ static int mov_open_dref(MOVContext *c, AVIOContext **pb, const char *src, MOVDr av_strlcat(filename, "../", sizeof(filename)); av_strlcat(filename, ref->path + l + 1, sizeof(filename)); - if (!c->use_absolute_path && !c->fc->open_cb) { + if (!c->use_absolute_path) { int same_origin = test_same_origin(src, filename); if (!same_origin) { @@ -2982,16 +2976,13 @@ static int mov_open_dref(MOVContext *c, AVIOContext **pb, const char *src, MOVDr if (strlen(filename) + 1 == sizeof(filename)) return AVERROR(ENOENT); - if (!open_func(c->fc, pb, filename, AVIO_FLAG_READ, int_cb, NULL)) + if (!c->fc->io_open(c->fc, pb, filename, AVIO_FLAG_READ, NULL)) return 0; } } else if (c->use_absolute_path) { av_log(c->fc, AV_LOG_WARNING, "Using absolute path on user request, " "this is a possible security issue\n"); - if (!open_func(c->fc, pb, ref->path, AVIO_FLAG_READ, int_cb, NULL)) - return 0; - } else if (c->fc->open_cb) { - if (!open_func(c->fc, pb, ref->path, AVIO_FLAG_READ, int_cb, NULL)) + if (!c->fc->io_open(c->fc, pb, ref->path, AVIO_FLAG_READ, NULL)) return 0; } else { av_log(c->fc, AV_LOG_ERROR, @@ -3052,8 +3043,7 @@ 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 (c->enable_drefs) { - if (mov_open_dref(c, &sc->pb, c->fc->filename, dref, - &c->fc->interrupt_callback) < 0) + if (mov_open_dref(c, &sc->pb, c->fc->filename, dref) < 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", @@ -4583,7 +4573,7 @@ static int mov_read_close(AVFormatContext *s) sc->drefs_count = 0; if (!sc->pb_is_copied) - avio_closep(&sc->pb); + ff_format_io_close(s, &sc->pb); sc->pb = NULL; av_freep(&sc->chunk_offsets); |