guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/01: gnu: libepoxy: Add patch to avoid segfault when GL support is mis


From: Ludovic Courtès
Subject: 01/01: gnu: libepoxy: Add patch to avoid segfault when GL support is missing.
Date: Fri, 9 Dec 2016 17:10:48 +0000 (UTC)

civodul pushed a commit to branch staging
in repository guix.

commit 13b5f44b475aa385d580f7e19b907210bc1d6d99
Author: Ludovic Courtès <address@hidden>
Date:   Fri Dec 9 18:09:43 2016 +0100

    gnu: libepoxy: Add patch to avoid segfault when GL support is missing.
    
    * gnu/packages/patches/libepoxy-gl-null-checks.patch: New file.
    * gnu/packages/gl.scm (libepoxy)[source]: Add it.
    * gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                       |    1 +
 gnu/packages/gl.scm                                |    3 +-
 gnu/packages/patches/libepoxy-gl-null-checks.patch |   54 ++++++++++++++++++++
 3 files changed, 57 insertions(+), 1 deletion(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 30f7b59..9b78e0a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -656,6 +656,7 @@ dist_patch_DATA =                                           
\
   %D%/packages/patches/libcanberra-sound-theme-freedesktop.patch \
   %D%/packages/patches/libcmis-fix-test-onedrive.patch         \
   %D%/packages/patches/libdrm-symbol-check.patch               \
+  %D%/packages/patches/libepoxy-gl-null-checks.patch           \
   %D%/packages/patches/libevent-dns-tests.patch                        \
   %D%/packages/patches/libextractor-ffmpeg-3.patch             \
   %D%/packages/patches/libjxr-fix-function-signature.patch     \
diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index 18d5d81..0e9b5dd 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -462,7 +462,8 @@ OpenGL graphics API.")
               (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
-                "1d1brhwfmlzgnphmdwlvn5wbcrxsdyzf1qfcf8nb89xqzznxs037"))))
+                "1d1brhwfmlzgnphmdwlvn5wbcrxsdyzf1qfcf8nb89xqzznxs037"))
+              (patches (search-patches "libepoxy-gl-null-checks.patch"))))
     (arguments
      `(#:phases
        (modify-phases %standard-phases
diff --git a/gnu/packages/patches/libepoxy-gl-null-checks.patch 
b/gnu/packages/patches/libepoxy-gl-null-checks.patch
new file mode 100644
index 0000000..bdc4b05
--- /dev/null
+++ b/gnu/packages/patches/libepoxy-gl-null-checks.patch
@@ -0,0 +1,54 @@
+This patch from <https://bugzilla.redhat.com/show_bug.cgi?id=1395366> adds NULL
+checks to avoid crashes when GL support is missing, as is the case when running
+Xvfb.
+
+Upstream issue: <https://github.com/anholt/libepoxy/issues/72>.
+
+diff -ur libepoxy-1.3.1/src/dispatch_common.c 
libepoxy-1.3.1/src/dispatch_common.c
+--- libepoxy-1.3.1/src/dispatch_common.c       2015-07-15 19:46:36.000000000 
-0400
++++ libepoxy-1.3.1/src/dispatch_common.c       2016-11-16 09:03:52.809066247 
-0500
+@@ -348,6 +348,8 @@
+ epoxy_extension_in_string(const char *extension_list, const char *ext)
+ {
+     const char *ptr = extension_list;
++    if (! ptr) return false;
++    if (! ext) return false;
+     int len = strlen(ext);
+ 
+     /* Make sure that don't just find an extension with our name as a prefix. 
*/
+@@ -380,6 +382,7 @@
+ 
+         for (i = 0; i < num_extensions; i++) {
+             const char *gl_ext = (const char *)glGetStringi(GL_EXTENSIONS, i);
++            if (! gl_ext) return false;
+             if (strcmp(ext, gl_ext) == 0)
+                 return true;
+         }
+diff -ur libepoxy-1.3.1/src/dispatch_egl.c libepoxy-1.3.1/src/dispatch_egl.c
+--- libepoxy-1.3.1/src/dispatch_egl.c  2015-07-15 19:46:36.000000000 -0400
++++ libepoxy-1.3.1/src/dispatch_egl.c  2016-11-16 08:40:34.069358709 -0500
+@@ -46,6 +46,7 @@
+     int ret;
+ 
+     version_string = eglQueryString(dpy, EGL_VERSION);
++    if (! version_string) return 0;
+     ret = sscanf(version_string, "%d.%d", &major, &minor);
+     assert(ret == 2);
+     return major * 10 + minor;
+diff -ur libepoxy-1.3.1/src/dispatch_glx.c libepoxy-1.3.1/src/dispatch_glx.c
+--- libepoxy-1.3.1/src/dispatch_glx.c  2015-07-15 19:46:36.000000000 -0400
++++ libepoxy-1.3.1/src/dispatch_glx.c  2016-11-16 08:41:03.065730370 -0500
+@@ -57,11 +57,13 @@
+     int ret;
+ 
+     version_string = glXQueryServerString(dpy, screen, GLX_VERSION);
++    if (! version_string) return 0;
+     ret = sscanf(version_string, "%d.%d", &server_major, &server_minor);
+     assert(ret == 2);
+     server = server_major * 10 + server_minor;
+ 
+     version_string = glXGetClientString(dpy, GLX_VERSION);
++    if (! version_string) return 0;
+     ret = sscanf(version_string, "%d.%d", &client_major, &client_minor);
+     assert(ret == 2);
+     client = client_major * 10 + client_minor;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]