Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-06-02 15:47:16 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2017-06-16 02:05:29 +0300
commit858adb27a0c9019e98e3dca167d5cc48cd6178c9 (patch)
tree59b5f379bb92f1c0547c3ac7fb6103ac62ebfa4b
parent6a44539bc80046676e5b0eee1a29af420a540299 (diff)
avformat/options: log filename on open
The loglevel is choosen so that the main filename and any images of multi image sequences are shown only at debug level to avoid clutter. This makes exploits in playlists more visible. As they would show accesses to private/sensitive files Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 53e0d5d7247548743e13c59c35e59fc2161e9582) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/options.c12
-rw-r--r--libavformat/utils.c2
2 files changed, 13 insertions, 1 deletions
diff --git a/libavformat/options.c b/libavformat/options.c
index 25a506eef8..9371c72667 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -102,6 +102,18 @@ static const AVClass av_format_context_class = {
static int io_open_default(AVFormatContext *s, AVIOContext **pb,
const char *url, int flags, AVDictionary **options)
{
+ int loglevel;
+
+ if (!strcmp(url, s->filename) ||
+ s->iformat && !strcmp(s->iformat->name, "image2") ||
+ s->oformat && !strcmp(s->oformat->name, "image2")
+ ) {
+ loglevel = AV_LOG_DEBUG;
+ } else
+ loglevel = AV_LOG_INFO;
+
+ av_log(s, loglevel, "Opening \'%s\' for %s\n", url, flags & AVIO_FLAG_WRITE ? "writing" : "reading");
+
#if FF_API_OLD_OPEN_CALLBACKS
FF_DISABLE_DEPRECATION_WARNINGS
if (s->open_cb)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 6d0f888aa8..cea3ab5a93 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -532,6 +532,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename,
if ((ret = av_opt_set_dict(s, &tmp)) < 0)
goto fail;
+ av_strlcpy(s->filename, filename ? filename : "", sizeof(s->filename));
if ((ret = init_input(s, filename, &tmp)) < 0)
goto fail;
s->probe_score = ret;
@@ -569,7 +570,6 @@ int avformat_open_input(AVFormatContext **ps, const char *filename,
}
s->duration = s->start_time = AV_NOPTS_VALUE;
- av_strlcpy(s->filename, filename ? filename : "", sizeof(s->filename));
/* Allocate private data. */
if (s->iformat->priv_data_size > 0) {