Add a bounds check in text_for_range() as well
This commit is contained in:
parent
74865efddb
commit
bdac5f7d5b
@ -1725,7 +1725,7 @@ text_for_range(Screen *self, const Selection *sel, bool insert_newlines) {
|
|||||||
iteration_data(self, sel, &idata, -self->historybuf->count, false);
|
iteration_data(self, sel, &idata, -self->historybuf->count, false);
|
||||||
PyObject *ans = PyTuple_New(idata.y_limit - idata.y);
|
PyObject *ans = PyTuple_New(idata.y_limit - idata.y);
|
||||||
if (!ans) return NULL;
|
if (!ans) return NULL;
|
||||||
for (int i = 0, y = idata.y; y < idata.y_limit; y++, i++) {
|
for (int i = 0, y = idata.y; y < idata.y_limit && y < (int)self->lines; y++, i++) {
|
||||||
Line *line = range_line_(self, y);
|
Line *line = range_line_(self, y);
|
||||||
XRange xr = xrange_for_iteration(&idata, y, line);
|
XRange xr = xrange_for_iteration(&idata, y, line);
|
||||||
char leading_char = (i > 0 && insert_newlines && !line->continued) ? '\n' : 0;
|
char leading_char = (i > 0 && insert_newlines && !line->continued) ? '\n' : 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user