mirror of
https://github.com/tmux/tmux.git
synced 2025-01-15 05:09:04 +00:00
Copy was using the real line length which after resize can be larger than the
screen width. When built with -DDEBUG, this made the grid bounds checking code kill the server. Restrict copying to the actual width. From Kalle Olavi Niemitalo, thanks.
This commit is contained in:
parent
4cbbbddf22
commit
289320a9b1
@ -522,7 +522,15 @@ window_copy_find_length(struct window_pane *wp, u_int py)
|
|||||||
const struct grid_cell *gc;
|
const struct grid_cell *gc;
|
||||||
u_int px;
|
u_int px;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the pane has been resized, its grid can contain old overlong
|
||||||
|
* lines. grid_peek_cell does not allow accessing cells beyond the
|
||||||
|
* width of the grid, and screen_write_copy treats them as spaces, so
|
||||||
|
* ignore them here too.
|
||||||
|
*/
|
||||||
px = wp->base.grid->size[py];
|
px = wp->base.grid->size[py];
|
||||||
|
if (px > screen_size_x(&wp->base))
|
||||||
|
px = screen_size_x(&wp->base);
|
||||||
while (px > 0) {
|
while (px > 0) {
|
||||||
gc = grid_peek_cell(wp->base.grid, px - 1, py);
|
gc = grid_peek_cell(wp->base.grid, px - 1, py);
|
||||||
if (gc->flags & GRID_FLAG_UTF8)
|
if (gc->flags & GRID_FLAG_UTF8)
|
||||||
|
Loading…
Reference in New Issue
Block a user