[code] [textadept] textadept-curses segfaults on Ubuntu 18.04

From: Chris Emerson <c-ta.att.mail.nosreme.org>
Date: Sun, 29 Apr 2018 09:09:24 +0100

Hi,

I just updated to 18.04, and textadept-curses now segfaults very easily (with
my normal ~/.textadept, as soon as I press space). This happened in 9.3, but
I've updated to 10.0 alpha 3 now and it still happens.

I rebuilt from source (still happens) and applied gdb; the problem seems to
be that the ncurses library now doesn't check for NULL passed to
pair_content() and dereferences it; the following change seems to fix it:

diff -ur scintilla-5135775cc8cc/curses/ScintillaCurses.cxx scintilla/curses/ScintillaCurses.cxx
--- scintilla-5135775cc8cc/curses/ScintillaCurses.cxx 2018-03-29 02:07:20.000000000 +0100
+++ scintilla/curses/ScintillaCurses.cxx 2018-04-29 08:59:48.232358746 +0100
@@ -337,8 +337,8 @@
                       int flags) {
     for (int x = rc.left, y = rc.top - 1; x < rc.right; x++) {
       attr_t attrs = mvwinch(win, y, x) & A_ATTRIBUTES;
- short pair = PAIR_NUMBER(attrs), fore = COLOR_WHITE;
- if (pair > 0) pair_content(pair, &fore, NULL);
+ short pair = PAIR_NUMBER(attrs), fore = COLOR_WHITE, dummy = COLOR_BLACK;
+ if (pair > 0) pair_content(pair, &fore, &dummy);
       mvwchgat(win, y, x, 1, attrs, term_color_pair(fore, fill), NULL);
     }
   }
@@ -420,8 +420,8 @@
                            const char *s, int len, ColourDesired fore) {
     if ((int)rc.top >= getmaxy(win) - 1) return;
     attr_t attrs = mvwinch(win, (int)rc.top, (int)rc.left);
- short pair = PAIR_NUMBER(attrs), back = COLOR_BLACK;
- if (pair > 0) pair_content(pair, NULL, &back);
+ short pair = PAIR_NUMBER(attrs), back = COLOR_BLACK, dummy = COLOR_WHITE;
+ if (pair > 0) pair_content(pair, &dummy, &back);
     DrawTextNoClip(rc, font_, ybase, s, len, fore, SCI_COLORS[back]);
   }
   /**

Chris

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sun 29 Apr 2018 - 04:09:24 EDT

This archive was generated by hypermail 2.2.0 : Sun 29 Apr 2018 - 06:27:43 EDT