[Top][All Lists]

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

ncursesw crashes when inserting invalid characters

From: Clemens Ladisch
Subject: ncursesw crashes when inserting invalid characters
Date: Fri, 29 May 2009 09:00:04 +0200
User-agent: Thunderbird (Windows/20090302)


the following program, when linked to ncursesw, segfaults due to an
infinite recursion in _nc_insert_ch():

#include <curses.h>
int main() {

Apparently, _nc_insert_ch(), when confronted with an unprintable
character, tries to get a printable representation with unctrl(), but
unctrl() just returns a string containing the original character.  This
is because safe_unctrl() calls iswprint() on its parameter despite that
character not being a wide character.

As far as I can tell, safe_unctrl() calls both isprint() and iswprint()
because it tries to work for both unctrl() and wunctrl(), but this
combination ends up being wrong for either case in any encoding except
ISO 8859-1.

It seems waddch_literal() works around this unctrl() bug by checking
that the returned string is longer than one character.

Best regards,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]