Crash with high-bit input
Closed this issue · 1 comments
bentley commented
I don't know if this is related to the previous issue. If I copy an invalid UTF-8 character to the clipboard (via xclip or similar), open nvi, enter insert mode, and paste the character, nvi prints "Invalid input. Truncated" (good) and then crashes (bad). 100% reproducible on OpenBSD amd64.
$ echo $LC_CTYPE
en_US.UTF-8
$ printf "\x80" | xclip
$ nvi # open nvi, enter insert mode, then paste
Abort trap (core dumped)
(gdb) bt
#0 0x000003897e6f698a in kill () at <stdin>:2
#1 0x000003897e75d161 in abort () at /usr/src/lib/libc/stdlib/abort.c:68
#2 0x000003877ad13e6f in v_event_err (sp=0x63f3, evp=0x7f7ffffcadf0)
at /usr/ports/pobj/nvi-2.1.1-iconv/nvi-2.1.1/common/key.c:811
#3 0x000003877ad42ce2 in v_txt (sp=0x38986fac630, vp=0x7f7ffffcb010, tm=Variable "tm" is not available.
)
at /usr/ports/pobj/nvi-2.1.1-iconv/nvi-2.1.1/vi/v_txt.c:527
#4 0x000003877ad3c2b6 in v_ii (sp=0x38986fac630, vp=0x7f7ffffcb010)
at /usr/ports/pobj/nvi-2.1.1-iconv/nvi-2.1.1/vi/v_itxt.c:163
#5 0x000003877ad48531 in vi (spp=0x7f7ffffcb228)
at /usr/ports/pobj/nvi-2.1.1-iconv/nvi-2.1.1/vi/vi.c:229
#6 0x000003877ad1773a in editor (gp=0x3897df29000, argc=1,
argv=0x7f7ffffcb420)
at /usr/ports/pobj/nvi-2.1.1-iconv/nvi-2.1.1/common/main.c:421
#7 0x000003877ad0d4d1 in main (argc=1, argv=0x7f7ffffcb418)
at /usr/ports/pobj/nvi-2.1.1-iconv/nvi-2.1.1/cl/cl_main.c:120
lichray commented
On Sun, Feb 3, 2013 at 11:04 AM, Anthony J. Bentley <
notifications@github.com> wrote:
$ printf "\x80" | xclip
This is an invalid UTF-8 data, true, but at the same time, it's regarded
as an invalid terminal event to both POSIX and vi, so both reactions
(error msg and abort()) are right.
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
4BSD -- http://4bsd.biz/