Public bug reported:
gnome-terminal-server (PID 2700) received SIGSEGV while rendering glyphs on
Ubuntu 22.04.5. systemd-coredump captured a 3.4 MB core. With libcairo2 debug
symbols the fault is in _emit_glyphs_chunk() in
src/cairo-xlib-render-compositor.c, writing past a 64-entry XGlyphElt8 stack
array.
Environment
-----------
OS: Ubuntu 22.04.5 LTS (jammy), X11 session (XDG_SESSION_TYPE=x11), GNOME
Kernel at crash: 6.8.0-138-generic
CPU: AMD Ryzen 5 3600X (12 logical CPUs)
GPU: NVIDIA TU102 [GeForce RTX 2080 Ti Rev. A], driver 550.163.01
Packages:
libcairo2 1.16.0-5ubuntu2.1
build-id 92b77d9d96478523ebb65dad17a9373571f4bbe7
gnome-terminal 3.44.0-1ubuntu1
libvte-2.91-0 0.68.0-1ubuntu0.1
Displays: HP 22m on HDMI-0; a portable panel on USB-C-0 (NVIDIA DFP-7,
shown by Xorg as "California institute of Technology TYPE-C"). The USB-C
output re-probes about every 5 seconds.
Crash
-----
Time: 2026-11-08 08:02:30.918 CET (07:02:30Z)
Process: /usr/libexec/gnome-terminal-server
Signal: 11 (SEGV)
Kernel line: gnome-terminal-[2700]: segfault at 7fff378d8000
ip 000079c36e376080 sp 00007fff378d0e30 error 4 in
libcairo.so.2.11600.0
With libcairo2 debug symbols:
#0 _emit_glyphs_chunk (...) at src/cairo-xlib-render-compositor.c:1477
if (_start_new_glyph_elt (j, &glyphs[i]))
Registers at the fault:
r9 0x1000030 num_glyphs = 16,777,264
r12 0x7fff378d2160 glyphs pointer (consistent with cairo's
85-entry stack_transformed_glyphs array)
r10/r11 0x28b nelt = 651 elements written
rbp 0x7fff378d0e70 elts = stack_elts (64-entry array)
rcx 0x7fff378d7ff8 current glyph; the +8 read is the fault
fault 0x7fff378d8000 first unmapped byte above the main-thread stack
Why this looks like a cairo defect
----------------------------------
_emit_glyphs_chunk declares XGlyphElt8 stack_elts[64] (2048 bytes) and uses
it when num_elts <= 64 (line 1458). The loop iterates num_glyphs and writes
elts[nelt] for every new element (line 1483). nelt is not bounded by the array
length.
Here num_glyphs was 16,777,264 while num_elts selected the stack path; by the
fault the loop had written 651 elements (20,832 bytes) into a 2,048-byte array.
The saved registers and saved return address at rsp+0x858..0x888 were
overwritten; the saved RIP is stack data (0x7fff378d21e6), so the caller frame
cannot be unwound from the core. assert(nelt == num_elts) (line 1507) is
compiled out in release builds and would not prevent the writes anyway.
The glyph pointer lies in the stack region used for cairo's 85-entry
stack_transformed_glyphs array (2048 / sizeof(cairo_glyph_t) = 85), so the
original run was likely <= 85 glyphs. The 16.7 M count is inconsistent with
that array and is the immediate defect. The XGlyphElt8 records left on the
stack contain glyphset=0x1e000a6, the value read from info->glyphset,
confirming the writes come from this function.
I also checked the cairo 1.18.6 source tarball: _emit_glyphs_chunk still has
the same unbounded elts[nelt] loop and no length check against stack_elts.
Trigger
-------
Xorg re-probed every NVIDIA output at 08:02:30.122-30.171; the HP 22m (DFP-2)
and TYPE-C (DFP-7) outputs were re-reported as connected. The crash followed
about 0.75 s later. The same re-probe repeats every ~5 s
(08:10:39-49, 08:13:59-14:04, ...), so the trigger is still active and
recurrence risk remains.
The terminal had a heavy VTE child (9 min 45 s CPU in its scope, terminated
with the server) and had been open since 07:33. A full redraw during the
display reconfiguration is the likely trigger.
Reproduction
------------
1. Use an X11 session with NVIDIA 550.163.01 and a DisplayPort output that
re-probes every few seconds (the USB-C-0 / DFP-7 output on this host).
2. Run gnome-terminal with continuous output or several tabs and force a
redraw while the output re-probes.
3. Capture the core and symbolicate libcairo2 (debuginfod or
libcairo2-dbgsym), then inspect _emit_glyphs_chunk and the elts array.
Not deterministic: 2 crashes in about 14 hours. The second occurrence is this
report.
Evidence
--------
Attached: backtrace.txt, crash-analysis.md, hotplug-window.txt, packages.txt,
core-sha256.txt. The raw core is not attached because it contains terminal
contents and process memory.
Requested action
----------------
cairo: confirm the failure mode and whether _emit_glyphs_chunk should bound
nelt by the element-array length and/or validate num_glyphs against the
caller-provided array. Advise whether a defensive fix is warranted for 1.16.x
and Ubuntu 22.04.
GNOME Terminal / VTE: check DrawingContext::draw_text_internal
(cr_glyphs[MAX_RUN_LENGTH], MAX_RUN_LENGTH=100) for a path that can pass an
inconsistent count after a display reconfiguration.
Ubuntu: evaluate a backport if upstream identifies a fix; advise on a
workaround.
Workaround: remove or replace the flapping USB-C output; keep the core for
triage.
Reporter
--------
Gerard Sala
https://www.linkedin.com/in/gerard-sala/
https://github.com/scripting-drafts
** Affects: cairo (Ubuntu)
Importance: Undecided
Status: New
** Tags: cairo gnome-terminal nvidia sigsegv x11
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2174600
Title:
libcairo2 _emit_glyphs_chunk overflows XGlyphElt8 stack_elts (gnome-
terminal-server SIGSEGV)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cairo/+bug/2174600/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs