Bounds check for apply selection

Fixes #2400
This commit is contained in:
Kovid Goyal 2020-02-27 20:27:20 +05:30
parent 507fbc7abf
commit 8c1ef94b26
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1696,6 +1696,7 @@ apply_selection(Screen *self, uint8_t *data, const Selection *s, IterationData *
iteration_data(self, s, last_rendered, 0, true); iteration_data(self, s, last_rendered, 0, true);
for (int y = last_rendered->y; y < last_rendered->y_limit; y++) { for (int y = last_rendered->y; y < last_rendered->y_limit; y++) {
if (y > (int)self->lines - 1) break;
Line *line = visual_line_(self, y); Line *line = visual_line_(self, y);
uint8_t *line_start = data + self->columns * y; uint8_t *line_start = data + self->columns * y;
XRange xr = xrange_for_iteration(last_rendered, y, line); XRange xr = xrange_for_iteration(last_rendered, y, line);