mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-25 08:31:43 +00:00
terminal: fix out-of-bounds access in CSI W handler with no params
CSI ? W (cursor tabulation control) accessed input.params[0] without first checking that params.len > 0, causing an index out-of-bounds panic when the sequence had an intermediate but no parameters. Add a params.len == 1 guard before accessing params[0]. Found by AFL++ fuzzing.
This commit is contained in:
@@ -1188,7 +1188,10 @@ pub fn Stream(comptime Handler: type) type {
|
||||
return;
|
||||
},
|
||||
|
||||
1 => if (input.intermediates[0] == '?' and input.params[0] == 5) {
|
||||
1 => if (input.intermediates[0] == '?' and
|
||||
input.params.len == 1 and
|
||||
input.params[0] == 5)
|
||||
{
|
||||
try self.handler.vt(.tab_reset, {});
|
||||
} else log.warn("invalid cursor tabulation control: {f}", .{input}),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user