xserver/glx
Peter Hutterer 901da57abf glx: fix reversed length check in ChangeDrawableAttributes
The request length validation in __glXDisp_ChangeDrawableAttributes and
__glXDispSwap_ChangeDrawableAttributes uses the wrong comparison direction.
The check tests whether the computed request size is LESS THAN
client->req_len, but should test whether it is GREATER THAN. With the
reversed operator, an undersized request (where numAttribs claims more
attribute pairs than the request actually contains) passes validation.

DoChangeDrawableAttributes then iterates numAttribs attribute pairs starting
from the end of the request header, reading past the actual request data
into adjacent memory. This is an out-of-bounds read that can also cause
an out-of-bounds write when a GLX_EVENT_MASK attribute key is found in the
overread data and its corresponding value is written to pGlxDraw->eventMask.

This patch effectively reverts commit 402b329c3a ("glx: Work around
wrong request lengths sent by mesa"). This was fixed in mesa commit
4324d6fdfbba1 in 2011 (mesa 7.11).

Fixes: 402b329c3a ("glx: Work around wrong request lengths sent by mesa")

This vulnerability was discovered by:
Anonymous working with TrendAI Zero Day Initiative

ZDI-CAN-30165

Assisted-by: Claude:claude-opus-4-6
(cherry picked from commit 6d459e4daf)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2230>
2026-06-02 09:53:42 +10:00
..
clientinfo.c glx: Can't mix declarations and code in X.org sources [CVE-2014-8098 pt. 9] 2014-12-09 11:27:26 -08:00
createcontext.c GLX: fix context render type queries 2020-11-26 20:07:55 +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
glxbyteorder.h Rewrite the byte swapping macros. 2017-04-25 15:01:23 -07:00
glxcmds.c glx: fix reversed length check in ChangeDrawableAttributes 2026-06-02 09:53:42 +10:00
glxcmdsswap.c glx: fix reversed length check in ChangeDrawableAttributes 2026-06-02 09:53:42 +10:00
glxcontext.h GLX: fix context render type queries 2020-11-26 20:07:55 +00:00
glxdrawable.h Add Windows-DRI extension 2016-09-15 20:10:29 +01:00
glxdri2.c Revert "dri2: Don't make reference to noClientException" 2020-01-28 13:26:41 -05:00
glxdricommon.c glx/dri: Filter out fbconfigs that don't have a supported pixmap format 2021-12-19 10:26:03 +00:00
glxdricommon.h glx: remove unused systemTimeExtension 2017-09-08 11:23:35 -07:00
glxdriswrast.c dix: Call SourceValidate before GetImage 2019-10-30 16:26:01 +00:00
glxext.c include: drop obsolete registry.h 2024-03-03 23:20:06 +00:00
glxext.h glx: Fix GLX_CONTEXT_RELEASE_BEHAVIOR_ARB handling 2019-05-01 14:38:09 +00:00
glxscreens.c glx: Do not call into Composite if it is disabled. 2018-04-10 14:37:47 -04:00
glxscreens.h glx: Use vnd layer for dispatch (v4) 2018-02-14 17:04:44 -05:00
glxserver.h glx: Enable GLX_ARB_create_context_no_error (v2) 2018-02-26 10:18:58 -05:00
glxutil.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
indirect_dispatch.c Drop trailing whitespaces 2014-11-12 10:25:00 +10:00
indirect_dispatch.h Drop trailing whitespaces 2014-11-12 10:25:00 +10:00
indirect_dispatch_swap.c glx: Remove unused bswap_CARD64 2020-11-30 16:22:26 +00:00
indirect_program.c glx: Remove True/False defines 2017-08-21 10:12:54 -04:00
indirect_reqsize.c glx: Pass remaining request length into ->varsize (v2) [CVE-2014-8098 8/8] 2014-12-08 18:09:50 -08: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 Drop trailing whitespaces 2014-11-12 10:25:00 +10:00
indirect_table.h Drop trailing whitespaces 2014-11-12 10:25:00 +10:00
indirect_texture_compression.c glx: Remove __glXReply 2017-06-20 16:39:23 -04:00
indirect_util.c Fix spelling/wording issues 2020-07-05 13:07:33 -07:00
indirect_util.h Drop trailing whitespaces 2014-11-12 10:25:00 +10:00
meson.build Drop Xorg DDX 2024-04-12 10:40:05 +02:00
render2.c glx: Convert non-generated function pointer thunking 2013-12-10 08:02:42 -08:00
render2swap.c glx: Convert non-generated function pointer thunking 2013-12-10 08:02:42 -08:00
renderpix.c glx: convert to direct GL dispatch (v2) 2013-10-29 12:29:16 -04:00
renderpixswap.c glx: convert to direct GL dispatch (v2) 2013-10-29 12:29:16 -04:00
rensize.c glx: Synchronize Xserver glx/rensize.c with mesa src/glx/compsize.c 2015-10-06 11:15:31 -04:00
single2.c glx: reject negative size in FeedbackBuffer and SelectBuffer requests 2026-05-30 10:47:07 -07:00
single2swap.c glx: reject negative size in FeedbackBuffer and SelectBuffer requests 2026-05-30 10:47:07 -07:00
singlepix.c glx: Remove __glXReply 2017-06-20 16:39:23 -04:00
singlepixswap.c glx: Remove __glXReply 2017-06-20 16:39:23 -04:00
singlesize.c glx: convert to direct GL dispatch (v2) 2013-10-29 12:29:16 -04:00
singlesize.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
swap_interval.c glx: Length-checking for non-generated vendor private requests [CVE-2014-8098 6/8] 2014-12-08 18:09:50 -08:00
unpack.h glx: Remove __glXReply 2017-06-20 16:39:23 -04:00
vnd_dispatch_stubs.c glx: Import glxvnd server module (v2) 2018-02-14 17:04:35 -05:00
vndcmds.c glx: move private definitions from vndserver.h to vndserver_priv.h 2024-02-22 23:52:03 +00:00
vndext.c glx: move private definitions from vndserver.h to vndserver_priv.h 2024-02-22 23:52:03 +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 glx: Import glxvnd server module (v2) 2018-02-14 17:04:35 -05:00
vndservervendor.h glx: Import glxvnd server module (v2) 2018-02-14 17:04:35 -05:00
xfont.c glx: Use vnd layer for dispatch (v4) 2018-02-14 17:04:44 -05:00