[FFmpeg-devel] [PATCH] lavf/os_support: Add safe win32 dlopen/dlclose/dlsym functions.

Michael Niedermayer michael at niedermayer.cc
Mon Aug 29 13:36:52 EEST 2016


On Mon, Aug 29, 2016 at 04:49:02PM +1000, Matt Oliver wrote:
> On 28 August 2016 at 19:58, Michael Niedermayer <michael at niedermayer.cc>
> wrote:
> 
> > On Sun, Aug 28, 2016 at 06:50:58PM +1000, Matt Oliver wrote:
> > > The dlopen function is modified to prevent loading dll's from the current
> > > directory for improved program security for library users. This extends
> > > similar functionality from the recently applied  SetDllDirectory patch
> > > except that it adds additional security for library users as well (as
> > > opposed to just program users).
> >
> > >  os_support.h |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
> > >  1 file changed, 49 insertions(+)
> > > 89c775ecc8ac03d001131dd50e043ba57ffe5420  0001-lavf-os_support-Add-safe-
> > win32-dlopen-dlclose-dlsym-.patch
> > > From 666ab2f7d64cfa94984881aca830355555993365 Mon Sep 17 00:00:00 2001
> > > From: Matt Oliver <protogonoi at gmail.com>
> > > Date: Sun, 21 Aug 2016 16:06:59 +1000
> > > Subject: [PATCH 1/2] lavf/os_support: Add safe win32 dlopen/dlclose/dlsym
> > >  functions.
> >
> > breaks mingw32
> >
> > In file included from src/libavformat/internal.h:28:0,
> >                  from src/libavdevice/lavfi.c:44:
> > src/libavformat/os_support.h: In function ‘win32_dlopen’:
> > src/libavformat/os_support.h:303:46: error: ‘LOAD_LIBRARY_SEARCH_APPLICATION_DIR’
> > undeclared (first use in this function)
> > src/libavformat/os_support.h:303:46: note: each undeclared identifier is
> > reported only once for each function it appears in
> > src/libavformat/os_support.h:303:84: error:
> > ‘LOAD_LIBRARY_SEARCH_SYSTEM32’ undeclared (first use in this function)
> > In file included from src/libavformat/internal.h:28:0,
> >                  from src/libavdevice/gdigrab.c:32:
> > src/libavformat/os_support.h: In function ‘win32_dlopen’:
> > src/libavformat/os_support.h:303:46: error: ‘LOAD_LIBRARY_SEARCH_APPLICATION_DIR’
> > undeclared (first use in this function)
> > src/libavformat/os_support.h:303:46: note: each undeclared identifier is
> > reported only once for each function it appears in
> > src/libavformat/os_support.h:303:84: error:
> > ‘LOAD_LIBRARY_SEARCH_SYSTEM32’ undeclared (first use in this function)
> > make: *** [libavdevice/lavfi.o] Error 1
> >
> 
> It appears older versions of mingw must not have the appropriate defines
> (as the version i tested against worked fine).
> Anyway updated patch attached which corrects the issue.

>  os_support.h |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
> c2ef0f80c68893318f803e65204583ee119636e7  0001-lavf-os_support-Add-safe-win32-dlopen-dlclose-dlsym-.patch
> From b77d65f76d22b4e9c5e630a8ae9154e98f9bfd88 Mon Sep 17 00:00:00 2001
> From: Matt Oliver <protogonoi at gmail.com>
> Date: Mon, 29 Aug 2016 16:45:02 +1000
> Subject: [PATCH 1/2] lavf/os_support: Add safe win32 dlopen/dlclose/dlsym
>  functions.
> 
> The dlopen function is modified to prevent loading dll's from the
> current directory for improved program security for library users and
> not just those that use ffmpeg programs.
> ---
>  libavformat/os_support.h | 55 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 55 insertions(+)

Tested-by: michael on mingw32 & 64

cant comment on the code itsef

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160829/c5e0de01/attachment.sig>


More information about the ffmpeg-devel mailing list