]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Fix assertion failure in xterm mouse tracking.
authorSimon Tatham <anakin@pobox.com>
Wed, 2 Sep 2015 17:56:20 +0000 (18:56 +0100)
committerSimon Tatham <anakin@pobox.com>
Wed, 2 Sep 2015 17:56:20 +0000 (18:56 +0100)
The original version of the xterm mouse tracking protocol did not
support character-cell coordinates greater than 223. If term_mouse()
got one, it would fail to construct an escape sequence for the mouse
event, and would then call ldisc_send() with a zero-length string -
which fails an assertion that I added in November (c269dd0135) on the
occasion of moving ldisc_echoedit_update() into its own function. So
the corresponding operation before that change would have done a
gratuitous ldisc_echoedit_update(), which is exactly the sort of thing
the assertion was there to catch :-)

Later extensions to the mouse tracking protocol support larger
coordinates anyway (try ESC[?1006h or ESC[?1015h in addition to the
ESC[?1000h that turns the whole system on in the first place). It's
only clients that don't use one of those extensions which would have
had the problem.

Thanks to Mirko Wolle for the report.

terminal.c

index dc727238a8236a7644b5e88469dc3fed7f8456e7..590f456a2b1110402af170a9b7fd8ca7dffd9b79 100644 (file)
@@ -6043,7 +6043,8 @@ void term_mouse(Terminal *term, Mouse_Button braw, Mouse_Button bcooked,
            } else if (c <= 223 && r <= 223) {
                len = sprintf(abuf, "\033[M%c%c%c", encstate + 32, c + 32, r + 32);
            }
-           ldisc_send(term->ldisc, abuf, len, 0);
+            if (len > 0)
+                ldisc_send(term->ldisc, abuf, len, 0);
        }
        return;
     }