Skip to contentSkip to conversation

libepoxy: add patch to fix segfaults when using in X11 without GLX

PATCH New Adrian Perez de Castro 2 participants 3 messages Aug 14, 2017 – Aug 16, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libepoxy: add patch to fix segfaults when using in X11 without GLX

This adds a patch cherry-picked from libepoxy 1.4.2, which adds missing NULL-pointer checks and avoids segmentation faults when using libepoxy under X11, when the server does not have the GLX extension, or it is disabled -- and applications can still use EGL.

---
 ...nal_has_gl_extension-epoxy_egl_version-ad.patch | 62 ++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 package/libepoxy/0003-epoxy_internal_has_gl_extension-epoxy_egl_version-ad.patch
package/libepoxy/0003-epoxy_internal_has_gl_extension-epoxy_egl_version-ad.patch new file +62 -0
new file mode 100644
index 0000000000..770d210097
@@ -0,0 +1,62 @@
+From 0e004b7344ea67fd682f33446d19e3b63a187513 Mon Sep 17 00:00:00 2001
+From: Gianfranco Costamagna <[email protected]>
+Date: Mon, 24 Apr 2017 16:10:28 +0200
+Subject: [PATCH] epoxy_internal_has_gl_extension, epoxy_egl_version: add some
+ missing nullpointer checks from
+ https://bugzilla.redhat.com/show_bug.cgi?id=1395366 Related commit:
+ b3b8bd9af7bf1fcfe544fd131f4d4f0d117ae7bc  Fix "epoxy_glx_version" to handle
+ the case when GLX is not active on the display. Patch is tweak from the
+ original version posted by Tom Horsley
+
+Backported from: https://github.com/anholt/libepoxy/pull/118
+
+Signed-off-by: Adrian Perez de Castro <[email protected]>
+---
+ src/dispatch_common.c | 9 ++++++++-
+ src/dispatch_egl.c    | 3 +++
+ 2 files changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/src/dispatch_common.c b/src/dispatch_common.c
+index b521b1b..a38c0fc 100644
+--- a/src/dispatch_common.c
++++ b/src/dispatch_common.c
+@@ -443,7 +443,12 @@ bool
+ epoxy_extension_in_string(const char *extension_list, const char *ext)
+ {
+     const char *ptr = extension_list;
+-    int len = strlen(ext);
++    int len;
++
++    if (!ext)
++        return false;
++
++    len = strlen(ext);
+ 
+     if (extension_list == NULL || *extension_list == '\0')
+         return false;
+@@ -478,6 +483,8 @@ epoxy_internal_has_gl_extension(const char *ext, bool invalid_op_mode)
+ 
+         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 --git a/src/dispatch_egl.c b/src/dispatch_egl.c
+index 50e66dd..f555a58 100644
+--- a/src/dispatch_egl.c
++++ b/src/dispatch_egl.c
+@@ -65,6 +65,9 @@ epoxy_egl_version(EGLDisplay dpy)
+     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;
+-- 
+2.14.1
+
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/1 libepoxy: add patch to fix segfaults when using in X11 without GLX

Hello,

Quoted 7 lines · Adrian Perez de Castro

This adds a patch cherry-picked from libepoxy 1.4.2, which adds missing NULL-pointer checks and avoids segmentation faults when using libepoxy under X11, when the server does not have the GLX extension, or it is disabled -- and applications can still use EGL.

---

Is there any chance of getting this merged before the 2017.08 release? If there is an area where there are ?interesting? GL setups which could hit the segfaults fixed by the patch, that's in the embedded world ;-)

(I know people are busy and that the backlog of patches to be reviewed is not precisely small, but I think it would be a pity that this would go missing in the release.)

Cheers,

--
Adri?n ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170816/48a9b0cd/attachment.asc>

#2 lore raw

PATCH 1/1 libepoxy: add patch to fix segfaults when using in X11 without GLX

In reply to Adrian Perez de Castro

Hello,

Quoted 10 lines · Adrian Perez de Castro

This adds a patch cherry-picked from libepoxy 1.4.2, which adds missing NULL-pointer checks and avoids segmentation faults when using libepoxy under X11, when the server does not have the GLX extension, or it is disabled -- and applications can still use EGL.

---
 ...nal_has_gl_extension-epoxy_egl_version-ad.patch | 62 ++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 package/libepoxy/0003-epoxy_internal_has_gl_extension-epoxy_egl_version-ad.patch

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com