aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2019-11-14 10:46:05 +0100
committerSören Tempel <soeren+git@soeren-tempel.net>2019-11-14 10:52:15 +0100
commit967fec19d05fd7513735f54c0da3a49ef6a11e3d (patch)
treeaa6c5b8af9b134b23265c8e1c7edf69950776e9c
parent9a4b8f04dafaa8ac635ac285f1ea3123ef510f93 (diff)
downloadaports-967fec19d05fd7513735f54c0da3a49ef6a11e3d.tar.bz2
aports-967fec19d05fd7513735f54c0da3a49ef6a11e3d.tar.xz
main/libedit: backport fix for segfault in one-line terminals
See: https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54654
-rw-r--r--main/libedit/APKBUILD8
-rw-r--r--main/libedit/fix-segfault-54654.patch30
2 files changed, 35 insertions, 3 deletions
diff --git a/main/libedit/APKBUILD b/main/libedit/APKBUILD
index 657d06e7c3..ddec9c2c71 100644
--- a/main/libedit/APKBUILD
+++ b/main/libedit/APKBUILD
@@ -2,7 +2,7 @@
pkgname=libedit
pkgver=20191025.3.1
_ver=${pkgver/./-}
-pkgrel=0
+pkgrel=1
pkgdesc="BSD line editing library"
url="https://www.thrysoee.dk/editline"
arch="all"
@@ -11,7 +11,8 @@ depends_dev="ncurses-dev"
makedepends_build=""
makedepends_host="$depends_dev"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
-source="https://www.thrysoee.dk/editline/libedit-$_ver.tar.gz"
+source="https://www.thrysoee.dk/editline/libedit-$_ver.tar.gz
+ fix-segfault-54654.patch"
builddir="$srcdir"/libedit-$_ver
build() {
@@ -38,4 +39,5 @@ package() {
rm "$pkgdir"/usr/share/man/man3/history.3*
}
-sha512sums="9f475249b984e02ece0af3a0efe353233fef644ecf37482e28597a3ce552ca5a07678939b2c4ecbe3d2b14761fa67f23d2e839a322b94c0feeeba9e403b2be00 libedit-20191025-3.1.tar.gz"
+sha512sums="9f475249b984e02ece0af3a0efe353233fef644ecf37482e28597a3ce552ca5a07678939b2c4ecbe3d2b14761fa67f23d2e839a322b94c0feeeba9e403b2be00 libedit-20191025-3.1.tar.gz
+f31b4dee12be07f16d0dd20be37da982b2f2a13a7ac4e52e0a7cb97112d1544df527d65bad200db5c704ca977f495e0601777bcb7928564804e4643c7d95743a fix-segfault-54654.patch"
diff --git a/main/libedit/fix-segfault-54654.patch b/main/libedit/fix-segfault-54654.patch
new file mode 100644
index 0000000000..282ee4bc3e
--- /dev/null
+++ b/main/libedit/fix-segfault-54654.patch
@@ -0,0 +1,30 @@
+This patch fixes a segfault in re_fastputc. This segfault happens in
+one-line terminals. It is a backport from upstream netbsd.
+
+See:
+
+ * https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54654
+ * https://freshbsd.org/commit/netbsd/src/PxLOa0eNmIl1zBKB
+
+diff -upr libedit-20191025-3.1.orig/src/terminal.c libedit-20191025-3.1/src/terminal.c
+--- libedit-20191025-3.1.orig/src/terminal.c 2019-11-14 10:41:42.834954338 +0100
++++ libedit-20191025-3.1/src/terminal.c 2019-11-14 10:43:13.164941706 +0100
+@@ -497,7 +497,7 @@ terminal_move_to_line(EditLine *el, int
+ if (where == el->el_cursor.v)
+ return;
+
+- if (where > el->el_terminal.t_size.v) {
++ if (where >= el->el_terminal.t_size.v) {
+ #ifdef DEBUG_SCREEN
+ (void) fprintf(el->el_errfile,
+ "%s: where is ridiculous: %d\r\n", __func__, where);
+@@ -647,7 +647,8 @@ terminal_overwrite(EditLine *el, const w
+ if (el->el_cursor.h >= el->el_terminal.t_size.h) { /* wrap? */
+ if (EL_HAS_AUTO_MARGINS) { /* yes */
+ el->el_cursor.h = 0;
+- el->el_cursor.v++;
++ if (el->el_cursor.v + 1 < el->el_terminal.t_size.v)
++ el->el_cursor.v++;
+ if (EL_HAS_MAGIC_MARGINS) {
+ /* force the wrap to avoid the "magic"
+ * situation */