On 4/22/07, David Ramsey <address@hidden> wrote: > No problem. Unfortunately, Murphy's Law kicked in, and I found one > more segfault bug in the justify code just after the release (while
> typing up the abbreviated news for the Freshmeat announcement, no > less).
For the record, the bug in 2.0.5 is as follows:
1. Start with a new file.
2. Type at least two lines' worth of text.
3. Go to the end of the text, turn the mark on, and go to the beginning of the text, so that the entire file is marked from bottom to top.
4. Hit Ctrl-J to justify the text. The mark will cover the entire
paragraph when it shouldn't. (Doing a word/line/character count at this point will give the wrong values, which is how I originally discovered it.)
5. Hit Ctrl-K to cut the text. The cursor should now be at the top of a
6. Hit Up. Segfault.
The problem is in backup_lines(). If openfile->current isn't at the top of the paragraph to be justified, it's skipped over when backing up the lines (so that the line after the last line of a paragraph isn't counted
when the paragraph is at least one line long and there's a magicline). This means that the mark's beginning line is never set to the right place in the newly copied lines, and the place it points to in the
backed-up lines is destroyed as soon as you don't unjustify.