Jere Viikari
unread,Jun 13, 2026, 4:57:02 PMJun 13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to tmux-users
Hello,
I found a crash in current tmux master while checking the custom layout
parser with GCC analyzer and ASan/UBSan.
This can be reproduced without any configuration:
tmux -Ltest -f/dev/null new-session -d
tmux -Ltest select-layout '007b,{'
The second command reports that the server exited unexpectedly. 007b is the
correct checksum for the layout payload {, so the input passes the initial
checksum validation but is otherwise malformed.
UBSan reports:
layout-custom.c:391:10: runtime error: member access within null pointer
layout-custom.c:391:10: runtime error: store to null pointer
The relevant call stack is:
#0 layout_construct() at layout-custom.c:391
#1 layout_parse() at layout-custom.c:194
#2 cmd_select_layout_exec() at cmd-select-layout.c:127
#3 cmdq_fire_command() at cmd-queue.c:649
It seems that layout_construct_cell() returns NULL because the payload does not
begin with a valid cell description:
*lc = layout_construct_cell(lcparent, layout);
However, when the next character is { or [, layout_construct() continues and
dereferences *lc:
(*lc)->type = LAYOUT_LEFTRIGHT;
The server should reject this layout as invalid instead of crashing. This seems
to be prevented by checking the result immediately:
*lc = layout_construct_cell(lcparent, layout);
if (*lc == NULL)
goto fail;
Thanks,
Jere