net-misc/freerdp: fix null pointer deref in primitives
authorMike Gilbert <floppym@gentoo.org>
Wed, 16 May 2018 21:18:42 +0000 (17:18 -0400)
committerMike Gilbert <floppym@gentoo.org>
Wed, 16 May 2018 21:18:42 +0000 (17:18 -0400)
Closes: https://bugs.gentoo.org/655904
Package-Manager: Portage-2.3.36_p22, Repoman-2.3.9_p215

net-misc/freerdp/files/2.0.0-rc2-primitives.patch [new file with mode: 0644]
net-misc/freerdp/freerdp-2.0.0_rc2-r1.ebuild [moved from net-misc/freerdp/freerdp-2.0.0_rc2.ebuild with 97% similarity]

diff --git a/net-misc/freerdp/files/2.0.0-rc2-primitives.patch b/net-misc/freerdp/files/2.0.0-rc2-primitives.patch
new file mode 100644 (file)
index 0000000..a82dec1
--- /dev/null
@@ -0,0 +1,41 @@
+From 9460f4292b130fcca58519a1c52b9aaef3265042 Mon Sep 17 00:00:00 2001
+From: Mike Gilbert <floppym@gentoo.org>
+Date: Wed, 16 May 2018 16:15:50 -0400
+Subject: [PATCH] primitives: ensure primitives_get() returns a populated
+ struct
+
+Fixes: https://github.com/FreeRDP/FreeRDP/issues/4658
+---
+ libfreerdp/primitives/primitives.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/libfreerdp/primitives/primitives.c b/libfreerdp/primitives/primitives.c
+index fd236df6e7..d25c5b41dc 100644
+--- a/libfreerdp/primitives/primitives.c
++++ b/libfreerdp/primitives/primitives.c
+@@ -28,10 +28,12 @@
+ #include "prim_internal.h"
+ /* Singleton pointer used throughout the program when requested. */
+-static primitives_t pPrimitives = { 0 };
+ static primitives_t pPrimitivesGeneric = { 0 };
+ static INIT_ONCE generic_primitives_InitOnce = INIT_ONCE_STATIC_INIT;
++#if defined(HAVE_OPTIMIZED_PRIMITIVES)
++static primitives_t pPrimitives = { 0 };
+ static INIT_ONCE primitives_InitOnce = INIT_ONCE_STATIC_INIT;
++#endif
+ /* ------------------------------------------------------------------------- */
+@@ -74,8 +76,10 @@ primitives_t* primitives_get(void)
+       InitOnceExecuteOnce(&generic_primitives_InitOnce, primitives_init_generic, NULL, NULL);
+ #if defined(HAVE_OPTIMIZED_PRIMITIVES)
+       InitOnceExecuteOnce(&primitives_InitOnce, primitives_init, NULL, NULL);
+-#endif
+       return &pPrimitives;
++#else
++      return &pPrimitivesGeneric;
++#endif
+ }
+ primitives_t* primitives_get_generic(void)
similarity index 97%
rename from net-misc/freerdp/freerdp-2.0.0_rc2.ebuild
rename to net-misc/freerdp/freerdp-2.0.0_rc2-r1.ebuild
index 48abe1a3fc71b676c96a84ab1c84da20b798285d..328ca08dce1144ccbbed7ea5cf92be2512ce84ae 100644 (file)
@@ -87,6 +87,10 @@ DEPEND="${RDEPEND}
        ) ) )
 "
 
+PATCHES=(
+       "${FILESDIR}"/2.0.0-rc2-primitives.patch
+)
+
 src_configure() {
        local mycmakeargs=(
                -DBUILD_TESTING=$(usex test)