Repeated pattern searching (`./' and holding `n' to reproduce) would
cause an out-of-bounds access, upstream quickly fixed the issue after
I reported it.
This also revealed an oversight on my site: Binaries are stripped
regardless of DEBUG, so patch upstream's Makefile until this is fixed
as well.
Tested on amd64 and sparc64, OK?
Index: Makefile
===================================================================
RCS file: /cvs/ports/editors/vis/Makefile,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile
--- Makefile 31 Mar 2018 11:06:39 -0000 1.2
+++ Makefile 10 Apr 2018 22:15:30 -0000
@@ -5,6 +5,7 @@ COMMENT = vi-like editor with sam-style
V = 0.5
DISTNAME = vis-v${V}
PKGNAME = vis-${V}
+REVISION = 0
TEST_V = 0.3
SUPDISTNAME = vis-test-${TEST_V}
Index: patches/patch-Makefile
===================================================================
RCS file: patches/patch-Makefile
diff -N patches/patch-Makefile
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-Makefile 10 Apr 2018 22:15:30 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Index: Makefile
+--- Makefile.orig
++++ Makefile
+@@ -136,10 +136,6 @@ luacheck:
+ @luacheck --config .luacheckrc lua test/lua | less -RFX
+
+ install: $(ELF)
+- @echo stripping executable
+- @for e in $(ELF); do \
+- ${STRIP} "$$e"; \
+- done
+ @echo installing executable files to ${DESTDIR}${PREFIX}/bin
+ @mkdir -p ${DESTDIR}${PREFIX}/bin
+ @for e in ${EXECUTABLES}; do \
Index: patches/patch-array_c
===================================================================
RCS file: patches/patch-array_c
diff -N patches/patch-array_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-array_c 10 Apr 2018 22:15:30 -0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+
+Fix segfault on repeated pattern searching, cherry-picked
+7d1f70e18cce00ca3fea43f392a3ea3a367f18b9.
+
+Index: array.c
+--- array.c.orig
++++ array.c
+@@ -119,7 +119,7 @@ bool array_remove(Array *arr, size_t idx) {
+ }
+ char *dest = arr->items + idx * arr->elem_size;
+ char *src = arr->items + (idx + 1) * arr->elem_size;
+- memmove(dest, src, (arr->len - idx) * arr->elem_size);
++ memmove(dest, src, (arr->len - idx - 1) * arr->elem_size);
+ arr->len--;
+ return true;
+ }