xserver/Xext/glx
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Enrico Weigelt, metux IT consult 4aeded65eb GLX: fix stale returnBufSize leading to NULL deref in __GLX_GET_ANSWER_BUFFER
realloc()'d straight into (cl)->returnBuf: on failure this left returnBuf
NULL but returnBufSize untouched at its prior (successful, smaller) value.
A later call whose size+align fits under that stale returnBufSize then
skips reallocating entirely (returnBufSize "looks" big enough) and
dereferences/writes through the NULL returnBuf.

Trigger (indirect GLX only): (1) a request causes a successful large
allocation, setting returnBufSize high; (2) a later request causes
realloc() to fail (OOM), leaving returnBuf NULL while returnBufSize stays
at the earlier high value; (3) a third request with size+align <= that
stale returnBufSize skips the realloc branch and derefs the NULL
returnBuf -- server crash.

Fix: realloc into a temporary first, only committing it (pointer + size
together) to (cl)->returnBuf/returnBufSize on success -- the same idiom
the sibling __glXGetAnswerBuffer() in indirect_util.c already uses
correctly for the same operation.

Found via a fleet-directed alloc-fail/UAF sweep of Xext/, not from a live
crash report. Confirmed this header is actually compiled into libxserver_glx
in this build (singlepix.c/indirect_program.c include it; both object
files recompiled after this header edit) and the full ninja build + meson
test suite (45/45, including pyxtest-test_glx.py) still pass -- but the
actual indirect-GLX request path this macro serves was not exercised at
runtime (no indirect-GLX client available in this environment), so this is
a lighter-weight verification than the other fixes in this sweep.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-08-24 13:40:12 +02:00
..
glx_dri xext: glx: use stdbool's 'bool' instead of 'Bool' for local variables 2026-08-07 14:24:00 +02:00
clientinfo.c
createcontext.c glx: fix integer overflow in CreateContextAttribsARB length check 2026-06-23 17:29:07 +02:00
extension_string.c glx: parentheses around macro argument symbols 2026-06-25 06:53:42 +02:00
extension_string.h Xext/glx: exports symbols to make extension shared 2026-07-28 12:31:45 +02:00
glxcmds.c xext: glx: use stdbool's 'bool' instead of 'Bool' for local variables 2026-08-07 14:24:00 +02:00
glxcmdsswap.c
glxcontext.h
glxdrawable.h
glxext.c glx: fix DrawableGone use-after-free without rejecting duplicate drawables 2026-07-21 13:22:41 +02:00
glxext.h
glxscreens.c treewide: replace min/max macros by non-exported MIN/MAX and deprecate them 2026-06-25 14:06:17 +02:00
glxscreens.h Xext/glx: exports symbols to make extension shared 2026-07-28 12:31:45 +02:00
glxserver.h Xext/glx: exports symbols to make extension shared 2026-07-28 12:31:45 +02:00
glxutil.h Xext/glx: exports symbols to make extension shared 2026-07-28 12:31:45 +02:00
indirect_dispatch.c
indirect_dispatch.h
indirect_dispatch_swap.c
indirect_program.c glx: use rpcbuf reply path in GetCompressedTexImage / GetProgramString 2026-06-26 19:34:14 +02:00
indirect_reqsize.c
indirect_reqsize.h
indirect_size.h
indirect_size_get.c
indirect_size_get.h
indirect_table.c
indirect_table.h glx: parentheses around macro argument symbols 2026-06-25 06:53:42 +02:00
indirect_texture_compression.c glx: use rpcbuf reply path in GetCompressedTexImage / GetProgramString 2026-06-26 19:34:14 +02:00
indirect_util.c glx: use rpcbuf reply path in __glXSendReplySwap() 2026-06-26 19:34:14 +02:00
indirect_util.h
meson.build
render2.c
render2swap.c
renderpix.c
renderpixswap.c
rensize.c glx: parentheses around macro argument symbols 2026-06-25 06:53:42 +02:00
single2.c glx: send empty Finish reply via X_SEND_REPLY_SIMPLE() 2026-06-26 19:34:14 +02:00
single2swap.c glx: send empty Finish reply via X_SEND_REPLY_SIMPLE() 2026-06-26 19:34:14 +02:00
singlepix.c glx: use rpcbuf reply path in singlepix.c pixel queries 2026-06-26 19:34:14 +02:00
singlepixswap.c glx: use rpcbuf reply path in singlepixswap.c pixel queries 2026-06-26 19:34:14 +02:00
singlesize.c
singlesize.h
swap_interval.c
unpack.h GLX: fix stale returnBufSize leading to NULL deref in __GLX_GET_ANSWER_BUFFER 2026-08-24 13:40:12 +02:00
vnd_dispatch_stubs.c
vndcmds.c glx: free old context tag before allocating new one in CommonMakeCurrent 2026-07-13 16:07:52 +02:00
vndext.c
vndserver_priv.h
vndservermapping.c
vndservervendor.c
vndservervendor.h
xfont.c glx: move GLYPHPADBYTES out of the SDK into its sole user 2026-06-29 15:49:32 +02:00