Fix a couple of out of bounds memory reads
This commit is contained in:
parent
73fa3c4a63
commit
3e1dac97ad
@ -318,7 +318,7 @@ void linebuf_delete_lines(LineBuf *self, index_type num, index_type y, index_typ
|
|||||||
for (i = y; i < y + num; i++) {
|
for (i = y; i < y + num; i++) {
|
||||||
self->scratch[i] = self->line_map[i];
|
self->scratch[i] = self->line_map[i];
|
||||||
}
|
}
|
||||||
for (i = y; i < ylimit; i++) {
|
for (i = y; i < ylimit && i + num < self->ynum; i++) {
|
||||||
self->line_map[i] = self->line_map[i + num];
|
self->line_map[i] = self->line_map[i + num];
|
||||||
self->continued_map[i] = self->continued_map[i + num];
|
self->continued_map[i] = self->continued_map[i + num];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,8 +110,9 @@ screen_resize(Screen *self, unsigned int lines, unsigned int columns) {
|
|||||||
Py_CLEAR(self->main_linebuf); self->main_linebuf = n;
|
Py_CLEAR(self->main_linebuf); self->main_linebuf = n;
|
||||||
bool index_after_resize = false;
|
bool index_after_resize = false;
|
||||||
if (is_main) {
|
if (is_main) {
|
||||||
linebuf_init_line(self->main_linebuf, self->cursor->y);
|
index_type cy = MIN(self->cursor->y, lines - 1);
|
||||||
if (is_x_shrink && (self->main_linebuf->continued_map[self->cursor->y] || line_length(self->main_linebuf->line) > columns)) {
|
linebuf_init_line(self->main_linebuf, cy);
|
||||||
|
if (is_x_shrink && (self->main_linebuf->continued_map[cy] || line_length(self->main_linebuf->line) > columns)) {
|
||||||
// If the client is in line drawing mode, it will redraw the cursor
|
// If the client is in line drawing mode, it will redraw the cursor
|
||||||
// line, this can cause rendering artifacts, so ensure that the
|
// line, this can cause rendering artifacts, so ensure that the
|
||||||
// cursor is on a new line
|
// cursor is on a new line
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user