back to square 2
walter harms
wharms at bfs.de
Sun Jun 22 14:36:41 UTC 2008
Hello Denys,hi list
i have still no clue why the error occurs.
while searching i notices something else:
static char *prev_line(char *p) // return pointer first char prev line
{
p = begin_line(p); // goto begining of cur line
if (p[-1] == '\n' && p > text)
p--; // step to prev line
p = begin_line(p); // goto begining of prev line
return p;
}
static char *next_line(char *p) // return pointer first char next line
{
p = end_line(p);
if (*p == '\n' && p < end - 1)
p++; // step to next line
return p;
}
please take a look at the if().
if (p[-1] == '\n' && p > text)
p--; // step to prev line
access to p[-1] and then checking that p is valid ?
Is there any guarantee that p>text will be evaluated first ?
i would suggest:
if ( p == text ) return p;
if (p[-1] == '\n') p--;
same goes for next_line().
re,
wh
ps: unfortunately my current vi.c is full of debug stuff but i hope you
can handle :)
Denys Vlasenko wrote:
> On Saturday 21 June 2008 16:29, walter harms wrote:
>> hi denis,
>> it seems that the patch has exposed some other error also:
>>
>> again clipping some data into vi it crashes. Now by a different reason:
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x0804f27c in char_insert (p=0x4018b006 "", c=10 '\n') at vi.c:1643
>> 1643 for (; isblank(*q); q++) {
>>
>> p q
>> $1 = 0x80995d7 <Address 0x80995d7 out of bounds>
>>
>> i will investigate further.
>
> Thanks.
> --
> vda
>
>
>
More information about the busybox
mailing list