mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-22 13:12:23 +00:00
Move too long CSI check out of parse loop
This commit is contained in:
parent
0f6d11351b
commit
0531b4bc79
1 changed files with 4 additions and 4 deletions
|
|
@ -789,10 +789,6 @@ static bool
|
|||
csi_parse_loop(PS *self, ParsedCSI *csi, const uint8_t *buf, size_t *pos, const size_t sz, const size_t start) {
|
||||
ByteLoader b; byte_loader_init(&b, buf + *pos, sz);
|
||||
while (*pos < sz) {
|
||||
if (UNLIKELY(*pos - start > MAX_ESCAPE_CODE_LENGTH)) {
|
||||
REPORT_ERROR("CSI escape too long ignoring and truncating");
|
||||
return true;
|
||||
}
|
||||
const uint8_t ch = byte_loader_next(&b); *pos += 1;
|
||||
switch(csi->state) {
|
||||
case CSI_START:
|
||||
|
|
@ -886,6 +882,10 @@ csi_parse_loop(PS *self, ParsedCSI *csi, const uint8_t *buf, size_t *pos, const
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (UNLIKELY(*pos - start > MAX_ESCAPE_CODE_LENGTH)) {
|
||||
REPORT_ERROR("CSI escape too long ignoring and truncating");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
#undef COMMIT_PARAM
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue