Skip to content
Commit e16ccb40 authored by Celeste Wouters's avatar Celeste Wouters 🐧 Committed by Matan Ziv-Av
Browse files

Clamp TerminalDisplay size to prevent buffer overflow crash

Konsole's code base uses a MAX_LINE_WIDTH define, currently set to 1024,
to act as sizes for various buffers used with ICU text shaping
algorithms, but no range checks are ever performed on those, meaning
that a display area of more than 1023 character cells wide will overflow
said buffers.

This can happen if you have a very large display, a small font size, or,
egregiously, if you disconnect all displays when running under a Wayland
compositor, prompting qt.qpa.wayland to create a fake screen of
potentially huge size.

This commit takes the easy way out by clamping the TerminalDisplay size
to MAX_LINE_WIDTH-1, which is large enough for most users (1023), and
better than crashing due to buffer overflows anyway.
parent 33e110c7
Pipeline #336519 passed with stage
in 2 minutes and 33 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment