Introduction
Introduction Statistics Contact Development Disclaimer Help
View source
# 2024-12-07 - Adventures In Bitrot, xvi Crash Fix
I have been using xvi as my EDITOR on Alpine Linux.
xvi
I log in in over the serial port from my FreeDOS desktop. When my
serial port speed is 9600 baud, everything works fine. When the
speed is 115200 baud, xvi crashes.
$ xvi
Segmentation fault
GDB reveals something in xvi-2.50.3/src/unix.c at line 576.
ospeed = cfgetospeed(&cooked_state);
When the baud rate is 115200, ospeed is set to 4098. The crash
actually happens in GNU termcap, in termcap-1.3.1/termcap.c at
line 336.
speed = speeds[ospeed];
The array range is from 0 to 18. When ospeed is 4098, it is way out
of bounds. I fixed this with the following local change.
--- xvi-2.50.3/src/unix.c.orig
+++ xvi-2.50.3/src/unix.c
@@ -574,6 +574,10 @@
#ifdef TERMIO
# ifdef POSIX
ospeed = cfgetospeed(&cooked_state);
+ if (ospeed > 18) {
+ /* GNU termcap can't handle large values */
+ ospeed = 0;
+ }
# else /* not POSIX */
ospeed = speeds[cooked_state.c_cflag & CBAUD];
# endif
gopher://tilde.pink/0/~bencollver/log/2024-12-07-adventures-in-bitrot-xvi-crash…
tags: bencollver,retrocomputing,technical,unix
# Tags
bencollver
retrocomputing
technical
unix
You are viewing proxied material from tilde.pink. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.