summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c22
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);