xserver/Xext/render
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Enrico Weigelt, metux IT consult eb9a108624 render: fix glyph Picture/Pixmap leak on ProcRenderAddGlyphs bail path
The bail: path freed a newly-realized (!found) glyph with a raw
'--refcnt; free(glyph)' instead of FreeGlyph(), skipping
FreeGlyphPicture()'s release of the glyph's per-screen Picture/Pixmap
(created earlier in the same function via CreatePicture()/CreatePixmap(),
attached via SetGlyphPicture()).

Trigger: send X_RenderAddGlyphs with >= 2 glyphs where an earlier glyph is
well-formed (gets fully realized) and a later one is malformed (e.g.
declares more bitmap bytes than present, hitting the BadLength/goto bail
above) -- the earlier glyph's Picture/Pixmap leaks every such request,
repeatable unbounded-leak DoS. No OOM needed.

Fix: call FreeGlyph() instead, for both found and !found glyphs -- it
already does the right thing for each: a bare refcnt-- for a found glyph
(matching the old behavior), and the full teardown (hash removal if
present, FreeGlyphPicture(), free the struct) for a !found one. Safe to
call on a glyph never added to the global hash yet (AddGlyph() only runs on
the success path below): the hash lookup keys off this glyph's own sha1 and
simply finds an empty slot to not remove.

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-08-24 13:42:01 +02:00
..
animcur.c xext: render: use stdbool's 'bool' instead of 'Bool' for local variables 2026-08-07 14:26:14 +02:00
filter.c render: filter: fix integer-overflow bypass of convolution size check 2026-07-03 19:59:53 +02:00
glyph.c render: parentheses around macro argument symbols 2026-06-25 06:53:30 +02:00
glyphstr_priv.h render: parentheses around macro argument symbols 2026-06-25 06:53:30 +02:00
matrix.c treewide: clean up includes of misc.h 2026-06-19 19:24:57 +02:00
meson.build
miindex.c xext: render: use stdbool's 'bool' instead of 'Bool' for local variables 2026-08-07 14:26:14 +02:00
mipict.c xext: render: use stdbool's 'bool' instead of 'Bool' for local variables 2026-08-07 14:26:14 +02:00
mirect.c
mitrap.c treewide: replace min/max macros by non-exported MIN/MAX and deprecate them 2026-06-25 14:06:17 +02:00
mitri.c
picture.c xext: render: use stdbool's 'bool' instead of 'Bool' for local variables 2026-08-07 14:26:14 +02:00
picturestr_priv.h render: parentheses around macro argument symbols 2026-06-25 06:53:30 +02:00
render.c render: fix glyph Picture/Pixmap leak on ProcRenderAddGlyphs bail path 2026-08-24 13:42:01 +02:00