1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-15 18:17:32 -05:00

Bounds-check terminal selection when clearing scrollback.

term_clrsb() was emptying the tree234 of scrollback, without checking
whether term->selstart, term->selend and term->selanchor were pointing
at places in the now-removed scrollback. If they were, then a
subsequent extend-selection operation could give rise to the dreaded
'line==NULL' assertion box.

Thanks to the user who sent in one of those debugging dumps, that
finally enabled us to track down (at least one case of) this
long- standing but extremely rare crash!
This commit is contained in:
Simon Tatham
2019-07-23 19:24:10 +01:00
parent c713ce4868
commit 80f5a009f6
2 changed files with 28 additions and 0 deletions

View File

@ -475,4 +475,9 @@ static inline bool decpos_fn(pos *p, int cols)
#define incpos(p) incpos_fn(&(p), GET_TERM_COLS)
#define decpos(p) decpos_fn(&(p), GET_TERM_COLS)
static inline pos bound_pos(pos p, pos lo, pos hi)
{
return poslt(p, lo) ? lo : poslt(p, hi) ? p : hi;
}
#endif