mesa/src
Hal Gentz 35d435235a glx: Fix SEGV due to dereferencing a NULL ptr from XCB-GLX.
When run in optirun, applications that linked to `libGLX.so` and then
proceeded to querying Mesa for extension strings caused a SEGV in Mesa.

`glXQueryExtensionsString` was calling a chain of functions that
eventually led to `__glXQueryServerString`. This function would call
`xcb_glx_query_server_string` then `xcb_glx_query_server_string_reply`.
The latter for some unknown reason returned `NULL`. Passing this `NULL`
to `xcb_glx_query_server_string_string_length` would cause a SEGV as the
function tried to dereference it.

The reason behind the function returning `NULL` is yet to be determined,
however, simply checking that the ptr is not `NULL` resolves this. A
similar check has been added to `__glXGetString` for completeness sake,
although not immediately necessary.

In addition to that, we stumbled into a similar problem in
`AllocAndFetchScreenConfigs` which tries to access the configs to free
them if `__glXQueryServerString` fails. This, of course, SEGVs, because the
configs are yet to have been allocated. Simply continuing past the configs
if their config ptrs are `NULL` resolves this. We also switch to `calloc`
to make sure that the config ptrs are `NULL` by default, and not some
uninitialized value.

Cc: mesa-stable@lists.freedesktop.org
Fixes: 24b8a8cfe8 "glx: implement __glXGetString, hide __glXGetStringFromServer"
Fixes: cb3610e37c "Import the GLX client side library, formerly from xc/lib/GL/glx. Build it "
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hal Gentz <zegentzy@protonmail.com>
(cherry picked from commit 1591d1fee5)
2019-09-06 10:30:46 +00:00
..
amd radv: additional query fixes 2019-08-26 13:30:15 +02:00
broadcom v3d: fix checking twice auf flag 2019-06-14 09:06:36 +00:00
compiler nir: fix memleak in error path 2019-09-05 16:01:12 +00:00
egl egl: fix deadlock in malloc error path 2019-09-05 16:56:04 +01:00
freedreno freedreno: Fix data races with allocating/freeing struct ir3. 2019-07-30 08:33:26 +00:00
gallium ttn: fix 64-bit shift on 32-bit 1 2019-09-05 15:49:07 +00:00
gbm meson: make nm binary optional 2019-05-03 10:58:05 -07:00
getopt
glx glx: Fix SEGV due to dereferencing a NULL ptr from XCB-GLX. 2019-09-06 10:30:46 +00:00
gtest delete autotools .gitignore files 2019-04-29 21:17:19 +00:00
hgl haiku: Fix hgl dispatch build. Tested under meson/scons. 2019-04-02 16:06:00 -05:00
imgui imgui: update memory editor 2019-02-26 12:49:07 +00:00
intel anv: fix format string in error message 2019-09-05 15:59:45 +00:00
loader Delete autotools 2019-04-15 13:44:29 -07:00
mapi meson: Search for execinfo.h 2019-07-02 09:57:34 +02:00
mesa mesa: Fix _mesa_float_to_unorm() on 32-bit systems. 2019-08-28 08:27:34 +00:00
util util/os_file: fix double-close() 2019-09-05 15:57:55 +00:00
vulkan vulkan/overlay: bounce image back to present layout 2019-09-03 11:37:15 +00:00
meson.build turnip: Add driver skeleton (v2) 2019-03-11 10:01:15 -07:00
SConscript scons: Remove gles option. 2018-10-19 16:50:26 +01:00