AmendHub

Download:

jcs

/

subtext

/

amendments

/

554

console: Revert previous, this was just an off-by-one

Clamping is done during CSI handling, so if we get here and we're
still out of bounds, this should panic.

jcs made amendment 554 about 1 year ago
--- console.c Sun Nov 19 10:03:13 2023 +++ console.c Sun Nov 19 10:49:40 2023 @@ -161,12 +161,9 @@ console_idle(struct focusable *focusable, EventRecord /* uncursor */ cursor = (console->cursor_line * console->ncolumns) + console->cursor_column; - if (cursor >= sizeof(console->attrs) - 1) { - console->cursor_line = console->nlines - 1; - console->cursor_column = console->ncolumns - 1; - cursor = (console->cursor_line * console->ncolumns) + - console->cursor_column; - } + if (cursor > sizeof(console->attrs) - 1) + panic("cursor (%dx%d) out of bounds", console->cursor_line, + console->cursor_column); console->attrs[cursor] &= ~ATTR_CURSOR; console->attrs[cursor] |= ATTR_DIRTY;