pkgsrc-ng/security/libgpg-error/patches/patch-src_estream.c
2016-01-21 23:40:00 +01:00

37 lines
1009 B
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

$NetBSD: patch-src_estream.c,v 1.2 2014/10/30 14:30:35 wiz Exp $
Don't use atexit(), since this library mey be dlopen()ed
and dlclose()d before exit() is called.
Instead mark the do_deinit() function as a destructor.
https://bugs.g10code.com/gnupg/issue1749
--- src/estream.c.orig 2014-09-11 09:38:21.000000000 +0000
+++ src/estream.c
@@ -471,6 +471,7 @@ do_list_remove (estream_t stream, int wi
+__attribute__((destructor,used))
static void
do_deinit (void)
{
@@ -503,7 +504,16 @@ _gpgrt_es_init (void)
if (!initialized)
{
initialized = 1;
+#if 0
+ /* This library may be unloaded via dlclose() before
+ * exit() is called, causing the atexit handler to try
+ * to jump into unmapped address space, causing a segfault.
+ * This has been observed with apache and php. Instead, use
+ * the destructor attribute, since that will cause it
+ * to be called on dlclose() as well.
+ */
atexit (do_deinit);
+#endif
}
return 0;
}