From patchwork Mon Aug 8 13:27:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hendrik Leppkes X-Patchwork-Id: 120 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.67 with SMTP id o64csp139294vsd; Mon, 8 Aug 2016 06:41:42 -0700 (PDT) X-Received: by 10.194.89.73 with SMTP id bm9mr72656227wjb.76.1470663702567; Mon, 08 Aug 2016 06:41:42 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id be6si7762552wjb.31.2016.08.08.06.41.41; Mon, 08 Aug 2016 06:41:42 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 285CF68A172; Mon, 8 Aug 2016 16:41:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EB991689FEF for ; Mon, 8 Aug 2016 16:41:10 +0300 (EEST) Received: by mail-wm0-f66.google.com with SMTP id i5so15534209wmg.2 for ; Mon, 08 Aug 2016 06:41:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=NVQmhX6lEQIXXE6pdSSULBLfRPb+1pecO2rJik6dvT8=; b=SmGYQ99eJAXCupDPf8vQFNugKuh3joJItO3M3/WvVQab9TPGh+LwC7sphcsaqH0+Tj GmEmt+CbXokZE4oFlx+v+HGk23lqDpN8VxqhCrppVPnm5fm2C8Sga8vxWVt5bbXfRuG4 B1gHDYpZj3hdqMq2UbWcXYohchuxtmSkkSNq3fVJanbCJpUAV7GeXNgndPzF9dLC8u21 QkmCRMIjGudMzN53cAhpyG7kF9XIFKtCW2ob/6Sgs8zp8fZN+JU770l+wFcWXzeQr0Az plGZgwNa6B8jWuuU8lzn2K5V3omvXplbEqTYZ3TEwrORk04+jdDbqiZDuoLi5Up38sg7 Z0PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=NVQmhX6lEQIXXE6pdSSULBLfRPb+1pecO2rJik6dvT8=; b=aPn7lNWbsG5y7X8BJBLecXPadWRlKi/13foMPvfKb/U83orXUeTn5UZvv99sttcUkf ge61pBq+OUrcQkqj2/Y70LsQIUS75IlICpG9I0nJm5kAHWxoCbwbsntSsZ0A8dswf9hb gwnjmc4j0lyBOCowPWQGM3+YawqBZeqL0yGVaKppCHRQxWBUau6vLBriA5umo46pz6SE kONag/0zPLAYKo3rNgRUo9eKZhvDhegNQCbUcilBIO8O2wjR7AzweD+Hn4XTPAsXT5Us vrVktgC4oGXJbnS/JQSuG7RXbBF9Cfq3IAbB9TyYLW87L2v9DhI9UAnaxFLtgk5/1fxC 1UIg== X-Gm-Message-State: AEkoous1uA83sNlFnTtZNlziJp3DphdOHPWpIVwUVyB3vWMfvXOH7M4HdfXlUIRCyaLCzw== X-Received: by 10.28.197.68 with SMTP id v65mr17047464wmf.2.1470662865516; Mon, 08 Aug 2016 06:27:45 -0700 (PDT) Received: from localhost (p5DC18604.dip0.t-ipconnect.de. [93.193.134.4]) by smtp.gmail.com with ESMTPSA id ya1sm22627323wjb.23.2016.08.08.06.27.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Aug 2016 06:27:44 -0700 (PDT) From: Hendrik Leppkes To: ffmpeg-devel@ffmpeg.org Date: Mon, 8 Aug 2016 15:27:41 +0200 Message-Id: <20160808132741.5180-1-h.leppkes@gmail.com> X-Mailer: git-send-email 2.9.2.windows.1 Subject: [FFmpeg-devel] [PATCH] cmdutils: remove the current working directory from the DLL search path on win32 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- cmdutils.c | 9 +++++++++ cmdutils.h | 5 +++++ ffmpeg.c | 2 ++ ffplay.c | 2 ++ ffprobe.c | 2 ++ ffserver.c | 1 + 6 files changed, 21 insertions(+) diff --git a/cmdutils.c b/cmdutils.c index 03a4836..6960f8c 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -107,6 +107,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 83ea4ad..67bf484 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 d6282bd..bae515d 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -4293,6 +4293,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 651e0cf..adbe9cb 100644 --- a/ffplay.c +++ b/ffplay.c @@ -3776,6 +3776,8 @@ int main(int argc, char **argv) char dummy_videodriver[] = "SDL_VIDEODRIVER=dummy"; char alsa_bufsize[] = "SDL_AUDIO_ALSA_SET_BUFFER_SIZE=1"; + init_dynload(); + av_log_set_flags(AV_LOG_SKIP_REPEATED); parse_loglevel(argc, argv, options); diff --git a/ffprobe.c b/ffprobe.c index a49be6a..657867d 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -3241,6 +3241,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 1a27583..453d790 100644 --- a/ffserver.c +++ b/ffserver.c @@ -3980,6 +3980,7 @@ int main(int argc, char **argv) int cfg_parsed; int ret = EXIT_FAILURE; + init_dynload(); config.filename = av_strdup("/etc/ffserver.conf");