xserver/glx
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nathan Kidd a4df686888 glx: Don't blindly write 8 bytes in GLX single replies
Previously we leaked stack when invalid enum parameters were
specified and caused __glGet*_size functions to return a 0 size.

Further, we read out-of-bounds (and leaked) when the input data was less
than 8 bytes (__glXDispSwap_GetFramebufferAttachmentParameteriv and
__glXDisp_GetRenderbufferParameteriv).

Now we only write a single element in the reply padding, and only when there
is a single element. This is what the Mesa client-side libGL expects, and
restores original GLX server behaviour, matching both pre-public (1996) SGI GLX
and XFree86 4.

The main risk of this change is if we have any error in element count or size;
previously it may not have mattered but now it does.

There are no piglit result changes from this modification using either mesa
libGLX or NVIDIA libGLX.

For performance considerations, an extra conditional and variable-length
memcpy has no meaningful impact on the indirect rendering pipeline cost.

There is still the possiblity to leak if our size checks allow an enum that
the GL implemention does not. Guarding against that requires zero-initializing
all temp storage, which wants re-evaluation of the blind 200-byte buffers
used for many calls and thus is a much bigger change.

Signed-off-by: Nathan Kidd <nkidd@rocketsoftware.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1647>
2025-07-02 13:00:47 -04:00
..
clientinfo.c glx: use sizeof() for reply struct 2025-02-06 20:04:23 +00:00
createcontext.c glx: use sizeof() for reply struct 2025-02-06 20:04:23 +00:00
extension_string.c glx: Implement GLX_EXT_get_drawable_type 2020-09-28 17:16:24 +00:00
extension_string.h glx: Implement GLX_EXT_get_drawable_type 2020-09-28 17:16:24 +00:00
glxcmds.c Revert "glx: use dixDestroyPixmap() instead of direct driver call" 2025-06-17 20:02:16 +00:00
glxcmdsswap.c drop obsolete HAVE_DIX_CONFIG_H 2024-10-10 13:38:31 +00:00
glxcontext.h GLX: fix context render type queries 2020-11-26 20:07:55 +00:00
glxdrawable.h
glxdri2.c Revert "os: log: replace LogMessageVerbSigSafe() by LogMessageVerb()" 2025-06-24 23:40:51 +00:00
glxdricommon.c drop obsolete HAVE_DIX_CONFIG_H 2024-10-10 13:38:31 +00:00
glxdricommon.h
glxdriswrast.c drop obsolete HAVE_DIX_CONFIG_H 2024-10-10 13:38:31 +00:00
glxext.c os: unexport ResetCurrentRequest() 2025-02-18 10:53:45 +00:00
glxext.h glx: Fix GLX_CONTEXT_RELEASE_BEHAVIOR_ARB handling 2019-05-01 14:38:09 +00:00
glxscreens.c drop obsolete HAVE_DIX_CONFIG_H 2024-10-10 13:38:31 +00:00
glxscreens.h
glxserver.h
glxutil.h
indirect_dispatch.c glx: drop obsolete warnings on files being generated 2025-02-06 14:29:54 +00:00
indirect_dispatch.h
indirect_dispatch_swap.c glx: drop obsolete warnings on files being generated 2025-02-06 14:29:54 +00:00
indirect_program.c glx: drop obsolete glxbyteorder.h 2025-02-06 14:29:54 +00:00
indirect_reqsize.c glx: drop obsolete glxbyteorder.h 2025-02-06 14:29:54 +00:00
indirect_reqsize.h drop remains of support for old Sun compilers 2024-02-19 09:21:36 +00:00
indirect_size.h drop remains of support for old Sun compilers 2024-02-19 09:21:36 +00:00
indirect_size_get.c drop remains of support for old Sun compilers 2024-02-19 09:21:36 +00:00
indirect_size_get.h drop remains of support for old Sun compilers 2024-02-19 09:21:36 +00:00
indirect_table.c
indirect_table.h
indirect_texture_compression.c glx: drop obsolete glxbyteorder.h 2025-02-06 14:29:54 +00:00
indirect_util.c glx: Don't blindly write 8 bytes in GLX single replies 2025-07-02 13:00:47 -04:00
indirect_util.h
meson.build meson: hide C API if Xorg is disabled (like autotools) 2021-03-11 00:22:36 +00:00
render2.c drop obsolete HAVE_DIX_CONFIG_H 2024-10-10 13:38:31 +00:00
render2swap.c drop obsolete HAVE_DIX_CONFIG_H 2024-10-10 13:38:31 +00:00
renderpix.c drop obsolete HAVE_DIX_CONFIG_H 2024-10-10 13:38:31 +00:00
renderpixswap.c drop obsolete HAVE_DIX_CONFIG_H 2024-10-10 13:38:31 +00:00
rensize.c drop obsolete HAVE_DIX_CONFIG_H 2024-10-10 13:38:31 +00:00
single2.c glx: use sizeof() for reply struct 2025-02-06 20:04:23 +00:00
single2swap.c glx: use sizeof() for reply struct 2025-02-06 20:04:23 +00:00
singlepix.c drop obsolete HAVE_DIX_CONFIG_H 2024-10-10 13:38:31 +00:00
singlepixswap.c drop obsolete HAVE_DIX_CONFIG_H 2024-10-10 13:38:31 +00:00
singlesize.c glx: Fix out-of-bounds reads from negative return 2025-07-02 12:54:39 -04:00
singlesize.h
swap_interval.c glx: drop obsolete glxbyteorder.h 2025-02-06 14:29:54 +00:00
unpack.h glx: use sizeof() for reply struct 2025-02-06 20:04:23 +00:00
vnd_dispatch_stubs.c
vndcmds.c glx: use sizeof() for reply struct 2025-02-06 20:04:23 +00:00
vndext.c Revert "os: move out extension disable flags to corresponing extensions" 2025-06-17 20:54:49 +00:00
vndserver.h glx: move private definitions from vndserver.h to vndserver_priv.h 2024-02-22 23:52:03 +00:00
vndserver_priv.h glx: move private definitions from vndserver.h to vndserver_priv.h 2024-02-22 23:52:03 +00:00
vndservermapping.c glx: move private definitions from vndserver.h to vndserver_priv.h 2024-02-22 23:52:03 +00:00
vndservervendor.c
vndservervendor.h
xfont.c drop obsolete HAVE_DIX_CONFIG_H 2024-10-10 13:38:31 +00:00