Fix panic parsing CSIs

The array lengths were transposed, so attempting to parse a CSI with more than 4
parameters would go out of bounds and panic.
This commit is contained in:
Mahmoud Al-Qudsi 2024-10-24 10:28:04 -05:00
parent 1b644226ec
commit 21860cbd39

View file

@ -806,7 +806,7 @@ pub trait InputEventQueuer {
fn parse_csi(&mut self, buffer: &mut Vec<u8>) -> Option<Key> { fn parse_csi(&mut self, buffer: &mut Vec<u8>) -> Option<Key> {
let mut next_char = |zelf: &mut Self| zelf.try_readb(buffer).unwrap_or(0xff); let mut next_char = |zelf: &mut Self| zelf.try_readb(buffer).unwrap_or(0xff);
let mut params = [[0_u32; 16]; 4]; let mut params = [[0_u32; 4]; 16];
let mut c = next_char(self); let mut c = next_char(self);
let private_mode; let private_mode;
if matches!(c, b'?' | b'<' | b'=' | b'>') { if matches!(c, b'?' | b'<' | b'=' | b'>') {