1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Add a bounds check in the word-by-word selection code to prevent

attempting to call lineptr() with a y-coordinate off the bottom of the
screen and triggering the dreaded 'line==NULL' message box.

This crash can only occur if the bottommost line of the screen has the
LATTR_WRAPPED flag set, which as far as I can see you can only
contrive by constructing a LATTR_WRAPPED line further up the screen
and then moving it down using an insert-line escape sequence. That's
probably why this bug has been around forever without anyone coming
across it.

[originally from svn r9726]
This commit is contained in:
Simon Tatham 2012-12-17 08:40:33 +00:00
parent c3df7b9b15
commit dbcd633985

View File

@ -5626,7 +5626,8 @@ static pos sel_spread_half(Terminal *term, pos p, int dir)
else
break;
} else {
if (ldata->lattr & LATTR_WRAPPED) {
if (p.y+1 < term->rows &&
(ldata->lattr & LATTR_WRAPPED)) {
termline *ldata2;
ldata2 = lineptr(p.y+1);
if (wordtype(term, UCSGET(ldata2->chars, 0))