Re: [dev] [st] [patch] multi-line selection causes core dump on OpenBSD
On Mon, Sep 23, 2013 at 10:50 AM, Roberto E. Vargas Caballero
<k0ga_AT_shike2.com> wrote:
>> I'm running OpenBSD 5.3 amd64 release version with the most current st
>> version from git and I noticed that st was crashing and dumping core
>> when selecting multiple lines whith the cursor. This happens, because
>> on line 964 of st.c (gp-1)->mode is accessed, although gp is still
>
> Good catch. I am using also OpenBSD and I have noticied the problem
> and it was in my queue ;).
>
>
>> pointing at the beginning of the array term.line[y] (see line 939 for
>> initialization of gp). A patch follows at the end of the mail. I
>> _quickly_ tested it and it _seems_ to work, but this should be verified
>> by someone else, since I don't know the st code and I only came up with
>> it by inspecting the core dump.
>
> The patch is correct, but I think there is a way easier:
>
> - if(y < sel.ne.y && !((gp-1)->mode & ATTR_WRAP))
> + if(y < sel.ne.y && x > 0 && !((gp-1)->mode & ATTR_WRAP))
>
logically, wouldn't that be
if(y < sel.ne.y && (x == 0 || !((gp-1)->mode & ATTR_WRAP)))
?
I think the outcome for x==0 would be different in your suggestion.
cheers!
mar77i
Received on Mon Sep 23 2013 - 10:54:00 CEST
This archive was generated by hypermail 2.3.0
: Mon Sep 23 2013 - 11:00:17 CEST