1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-20 11:17:15 +03:00

Avoid index OOB when parsing ITermFileData

This commit is contained in:
5225225 2022-05-14 23:30:52 +01:00 committed by Wez Furlong
parent 2c84ddf4ba
commit 9b39d69927
2 changed files with 12 additions and 2 deletions

View File

@ -881,8 +881,12 @@ impl ITermFileData {
let last = osc.len() - 1;
for (idx, s) in osc.iter().enumerate().skip(1) {
let param = if idx == 1 {
// skip over File=
&s[5..]
if s.len() >= 5 {
// skip over File=
&s[5..]
} else {
bail!("failed to parse file data; File= not found");
}
} else {
s
};

View File

@ -839,4 +839,10 @@ mod test {
actions
);
}
#[test]
fn itermfiledata_oob() {
let mut p = Parser::new();
p.parse_as_vec(b"\x9d1337\xff;File\x1b");
}
}