BB vi bug
Denys Vlasenko
vda.linux at googlemail.com
Tue Jun 24 14:10:43 UTC 2008
On Tuesday 24 June 2008 09:59, walter harms wrote:
>
> Denys Vlasenko wrote:
> > On Monday 23 June 2008 19:18, walter harms wrote:
> >> hi list,
> >> while testing to find a more easy way to produce the bug i notice that odd behavier here:
> >> 1. please note the ^@ i can produce that with a i <cr> in the first line
> >> 2. there are clearly 3 lines but the systems thinks i am in line 4
> >> everyone if free to join the hunt (note:the code is from the current svn vi.c)
> >>
> >>
>
>
>
> <------------Screenschot----------------->
> >jdjdjdjdjdjdj
> > dddddddddddddddddddddddddddddddd
> > ddddddddddddddddddddddddddd
> > ^@
> > ~
> > ~
> > ~
> > ~
> > - No file [Modified] 3/2 150%
> <----------------------------------------->
>
> >
> > Walter, you are obviously keeping much of state in your head.
> > For anyone who is not debugging vi at the moment the above
> > description doesn't make much sense - too much of state is
> > not spelled out.
> > --
>
> mea culpa,
> to replicate the strangeness i noted do the following.
> start latest vi from svn.
> 1. goto insert mode
> 2. press return a ^@ will show up
> it is not present in the snapshot from 2008-04-25
memmove was accidentally omitted:
// open a hole in text[]
static char *text_hole_make(char *p, int size) // at "p", make a 'size' byte hole
{
if (size <= 0)
return p;
end += size; // adjust the new END
if (end >= (text + text_size)) {
char *new_text;
text_size += end - (text + text_size) + 10240;
new_text = xrealloc(text, text_size);
screenbegin = new_text + (screenbegin - text);
dot = new_text + (dot - text);
end = new_text + (end - text);
p = new_text + (p - text);
text = new_text;
}
memmove(p + size, p, end - p); <=======================================
memset(p, ' ', size); // clear new hole
file_modified++;
return p;
}
--
vda
More information about the busybox
mailing list