xserver/Xext/dri2
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Enrico Weigelt, metux IT consult c03bc789ae dri2: fix off-by-one heap overflow in do_get_buffers() buffer array
The buffers array was sized min(count, DRI2BufferHiz) + 1, but count is
already capped at DRI2BufferHiz + 1 by the check above. The min() only
changes anything at that exact boundary (count == DRI2BufferHiz + 1), where
it throws away the array's '+1 slack' right when the main loop can
legitimately fill all 'count' slots itself, leaving no room for a
synthesized real/fake front buffer the client didn't explicitly request.

Trigger: a DRI2-capable client sends DRI2GetBuffers/DRI2GetBuffersWithFormat
with 11 attachment entries (the maximum allowed), none of them
DRI2BufferFrontLeft but at least one DRI2BufferBackLeft (so need_real_front
ends up set) -- the post-loop synthesis writes buffers[11], one past the
11-element allocation. Deterministic, no OOM required.

Fix: allocate count + 1 slots unconditionally; count is already bounded, so
this is never a meaningfully larger allocation.

Found via a fleet-directed alloc-fail/UAF sweep of Xext/, not from a live
crash report.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-07-09 12:56:04 +02:00
..
pci_ids Xext: parentheses around macro argument symbols 2026-06-25 07:37:12 +02:00
dri2.c dri2: fix off-by-one heap overflow in do_get_buffers() buffer array 2026-07-09 12:56:04 +02:00
dri2_priv.h
dri2ext.c xfixes: move it under the Xext/ directory 2026-06-17 15:33:32 +02:00
dri2int.h Xext: dri2: dri2int.h: fix missing include 2026-04-22 20:13:29 +02:00
meson.build