Skip to content

Commit

Permalink
Fix split in indent_mode.
Browse files Browse the repository at this point in the history
detected by afl-fuzz
  • Loading branch information
kcwu committed Aug 17, 2015
1 parent 4f26241 commit e686cb4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mbbsd/edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -993,8 +993,12 @@ split(textline_t * line, int pos)
curr_buf->oldcurrline = curr_buf->currline = p;
if (pos == curr_buf->currpnt)
curr_buf->currpnt = spcs;
else
curr_buf->currpnt -= pos;
else {
curr_buf->currpnt = curr_buf->currpnt - pos + spcs;
// In indent_mode, the length may be shorter.
if (curr_buf->currpnt > curr_buf->currline->len)
curr_buf->currpnt = curr_buf->currline->len;
}
curr_buf->curr_window_line++;
curr_buf->currln++;

Expand Down

0 comments on commit e686cb4

Please sign in to comment.