Skip to content

struct.error in set_window_size when terminal receives out-of-range window dimensions #22898

@maxreuth

Description

@maxreuth

Explain what happens

1.The cockpit-bridge crashes with an unhandled struct.error when a terminal channel receives a window resize (options) message containing a value outside the valid range for an unsigned 16-bit integer (0–65535).

2.Exception in callback _Transport._read_ready() handle: <Handle _Transport._read_ready()>
Traceback (most recent call last):
File "/usr/lib/python3.12/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
...
File "/usr/lib/python3/dist-packages/cockpit/channels/stream.py", line 87, in do_options
self._transport.set_window_size(window)
File "/usr/lib/python3/dist-packages/cockpit/transports.py", line 409, in set_window_size
fcntl.ioctl(self._pty_fd, termios.TIOCSWINSZ, struct.pack('2H4x', size.rows, size.cols))
struct.error: 'H' format requires 0 <= number <= 65535
3.

Version of Cockpit

cockpit-bridge (>= 314-1), cockpit-ws (>= 314-1), cockpit-system (>= 314-1)

Where is the problem in Cockpit?

Services

Server operating system

Ubuntu

Server operating system version

Ubuntu 24.04.4 LTS x86_64

What browsers are you using?

Brave

System log

...
Feb 18 18:48:58 xxx /usr/bin/cockpit-bridge[3094471]: Exception in callback _Transport._read_ready()
for solid 2 min
...

Feb 18 18:49:37 xxx /usr/bin/cockpit-bridge[3094471]: Exception in callback _Transport._read_ready()
Feb 18 18:49:49 xxx cockpit-session[3094464]: pam_unix(cockpit:session): session closed for user xxx
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions