Introduction
Introduction Statistics Contact Development Disclaimer Help
tacme: fix bufread crash due to typing-point scrolling - plan9port - [fork] Pla…
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
commit 50ababbd552abfa8ef3b16ccdaea54b58f5c031c
parent 6400c9f20c3cdab491cd2aec29cfd2ae632d5046
Author: Russ Cox <[email protected]>
Date: Tue, 3 Jun 2014 00:16:48 -0400
acme: fix bufread crash due to typing-point scrolling
Acme tracks the most recent typing insertion point and
tthe home and end keys stop there on their way
up to the top or down to the bottom of the file.
That point should be iq1, and it should be adjusted
properly so that it's always between 0 and t->file->b.nc inclusive.
(This is all code from an external contributor, years old at this
point but new since Plan 9.)
Somehow, sometimes iq1 ends up a little beyond b.nc,
and when passed to textbacknl it crashes acme in bufread.
I can't see how that can happen but if it does, avoid the crash.
It's tempting to pull the insertion point code out entirely
but this is a little less invasive and should fix things for now.
TBR=rsc
https://codereview.appspot.com/107730043
Diffstat:
M src/cmd/acme/text.c | 4 ++++
1 file changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/cmd/acme/text.c b/src/cmd/acme/text.c
t@@ -725,6 +725,10 @@ texttype(Text *t, Rune r)
case Kend:
typecommit(t);
if(t->iq1 > t->org+t->fr.nchars) {
+ if(t->iq1 > t->file->b.nc) {
+ // should not happen, but does. and it will cr…
+ t->iq1 = t->file->b.nc;
+ }
q0 = textbacknl(t, t->iq1, 1);
textsetorigin(t, q0, TRUE);
} else
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.