ffmpeg | branch: release/2.8 | Hendrik Leppkes <h.lepp...@gmail.com> | Mon Aug 8 15:27:41 2016 +0200| [65fff8e71ac92348c2bc8d4997aa5f732a5be321] | committer: Michael Niedermayer
cmdutils: remove the current working directory from the DLL search path on win32 Reviewed-by: Matt Oliver <protogo...@gmail.com> Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc> (cherry picked from commit 3bf142c77337814458ed8e036796934032d9837f) Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=65fff8e71ac92348c2bc8d4997aa5f732a5be321 --- cmdutils.c | 9 +++++++++ cmdutils.h | 5 +++++ ffmpeg.c | 2 ++ ffplay.c | 2 ++ ffprobe.c | 2 ++ ffserver.c | 2 ++ 6 files changed, 22 insertions(+) diff --git a/cmdutils.c b/cmdutils.c index 3543edd..bb4f49a 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -106,6 +106,15 @@ static void log_callback_report(void *ptr, int level, const char *fmt, va_list v } } +void init_dynload(void) +{ +#ifdef _WIN32 + /* Calling SetDllDirectory with the empty string (but not NULL) removes the + * current working directory from the DLL search path as a security pre-caution. */ + SetDllDirectory(""); +#endif +} + static void (*program_exit)(int ret); void register_exit(void (*cb)(int ret)) diff --git a/cmdutils.h b/cmdutils.h index 7f3db2a..e5ea45b 100644 --- a/cmdutils.h +++ b/cmdutils.h @@ -62,6 +62,11 @@ void register_exit(void (*cb)(int ret)); void exit_program(int ret) av_noreturn; /** + * Initialize dynamic library loading + */ +void init_dynload(void); + +/** * Initialize the cmdutils option system, in particular * allocate the *_opts contexts. */ diff --git a/ffmpeg.c b/ffmpeg.c index 602cbfa..2887e91 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -4118,6 +4118,8 @@ int main(int argc, char **argv) int ret; int64_t ti; + init_dynload(); + register_exit(ffmpeg_cleanup); setvbuf(stderr,NULL,_IONBF,0); /* win32 runtime needs this */ diff --git a/ffplay.c b/ffplay.c index 17327b0..76d8fc8 100644 --- a/ffplay.c +++ b/ffplay.c @@ -3684,6 +3684,8 @@ int main(int argc, char **argv) VideoState *is; char dummy_videodriver[] = "SDL_VIDEODRIVER=dummy"; + init_dynload(); + av_log_set_flags(AV_LOG_SKIP_REPEATED); parse_loglevel(argc, argv, options); diff --git a/ffprobe.c b/ffprobe.c index 3e5324e..ed8babf 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -3142,6 +3142,8 @@ int main(int argc, char **argv) char *w_name = NULL, *w_args = NULL; int ret, i; + init_dynload(); + av_log_set_flags(AV_LOG_SKIP_REPEATED); register_exit(ffprobe_cleanup); diff --git a/ffserver.c b/ffserver.c index 8b6e441..822e729 100644 --- a/ffserver.c +++ b/ffserver.c @@ -3817,6 +3817,8 @@ int main(int argc, char **argv) struct sigaction sigact = { { 0 } }; int ret = 0; + init_dynload(); + config.filename = av_strdup("/etc/ffserver.conf"); parse_loglevel(argc, argv, options); _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog