NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/54272: libedit segfaults on Linux aarch64 build



>Number:         54272
>Category:       lib
>Synopsis:       libedit segfaults on Linux aarch64 build
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 04 20:30:00 +0000 2019
>Originator:     Mitch Felton
>Release:        libedit-20190324-3.1
>Organization:
Western Digital
>Environment:
Linux dhcp-10-202-62-242 4.15.0-50-generic #54-Ubuntu SMP Tue May 7 05:57:03 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux
>Description:
I encounter a segfault when using an aarch64 compiled version of libedit version 3.1 (2019-03-24).
>How-To-Repeat:

>Fix:
There are 2 fixes in src/terminal.c in the terminal_set() function.
- Initialize 'buf' to zeros before using it
- pass 'area' into terminal_alloc() correctly
A patch for these changes is shown below. These 2 changes fix the segfault and libedit functions correctly for me with them.

--- a/src/terminal.c
+++ b/src/terminal.c
@@ -848,6 +848,8 @@ terminal_set(EditLine *el, const char *term)
 	sigset_t oset, nset;
 	int lins, cols;
 
+	(void) memset(buf, 0, TC_BUFSIZE);
+
 	(void) sigemptyset(&nset);
 	(void) sigaddset(&nset, SIGWINCH);
 	(void) sigprocmask(SIG_BLOCK, &nset, &oset);
@@ -898,7 +900,7 @@ terminal_set(EditLine *el, const char *term)
 		for (t = tstr; t->name != NULL; t++) {
 			/* XXX: some systems' tgetstr needs non const */
 			terminal_alloc(el, t, tgetstr(strchr(t->name, *t->name),
-			    &area));
+			    area));
 		}
 	}

This fix is offered under the BSD license by Mitch Felton, an employee of Western Digital.



Home | Main Index | Thread Index | Old Index