Message ID | 20170602130527.25730-1-michael@niedermayer.cc |
---|---|
State | New |
Headers | show |
On Fri, 2 Jun 2017 15:05:27 +0200 Michael Niedermayer <michael@niedermayer.cc> wrote: > 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> > --- > libavformat/options.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/libavformat/options.c b/libavformat/options.c > index 25a506eef8..07a8a1a46b 100644 > --- a/libavformat/options.c > +++ b/libavformat/options.c > @@ -102,6 +102,17 @@ 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) Mixed opinion about logging that seems dumb, but at least an API user can prevent it. But please, don't clutter the code with even more image2 exceptions and special handling.
On Fri, Jun 02, 2017 at 03:45:58PM +0200, wm4 wrote: > On Fri, 2 Jun 2017 15:05:27 +0200 > Michael Niedermayer <michael@niedermayer.cc> wrote: > > > 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> > > --- > > libavformat/options.c | 11 +++++++++++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/libavformat/options.c b/libavformat/options.c > > index 25a506eef8..07a8a1a46b 100644 > > --- a/libavformat/options.c > > +++ b/libavformat/options.c > > @@ -102,6 +102,17 @@ 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) > > Mixed opinion about logging that seems dumb, but at least an API user > can prevent it. > > But please, don't clutter the code with even more image2 exceptions and > special handling. ok applied thanks [...]
diff --git a/libavformat/options.c b/libavformat/options.c index 25a506eef8..07a8a1a46b 100644 --- a/libavformat/options.c +++ b/libavformat/options.c @@ -102,6 +102,17 @@ 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)
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> --- libavformat/options.c | 11 +++++++++++ 1 file changed, 11 insertions(+)