Menu

#11 Segmentation fault occurs on undo.

None
closed
None
5
2023-03-07
2022-02-06
No

Environment

  • Version: bvi 1.4.1
  • OS: Debian GNU/Linux 11 (Bullseye), Cygwin 3.3.4

Overview

I have encountered segmentation fault on undo.

How to reproduce the issue

  1. Start bvi.
  2. Enter :set mm
  3. Press 'A' and enter 0x41 at address 0 and press 'ESC' key.
  4. Yank one byte on address 0 by 'y+space'.
  5. Move cursor to address 1.
  6. Paste one byte from yank buffer by 'p'. (Not 0x41 but 0x00 will be pasted on address 1.)
  7. Undo with 'u'.
  8. Segmentation fault occurs.

The patch for this issue

diff --git a/bvi.c b/bvi.c
index dcc1f85..6f087e3 100644
--- a/bvi.c
+++ b/bvi.c
@@ -918,7 +918,7 @@ do_put(loc, n, buf)
                emsg(nobytes);
                return;
        }

-       if (loc > maxpos) {
+       if (loc >= maxpos) {
                beep();
                return;
        }

Discussion

  • Gerhard Buergmann

    • status: open --> closed
    • assigned_to: Gerhard Buergmann
    • Group: -->
     
  • Gerhard Buergmann

    Fixed in 1.4.2

     

Log in to post a comment.

MongoDB Logo MongoDB