NetBSD-Bugs archive

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

lib/51670: curses: printw displays multibyte string wrong if ASAN is not used



>Number:         51670
>Category:       lib
>Synopsis:       curses: printw displays multibyte string wrong if ASAN is not used
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 29 09:45:00 +0000 2016
>Originator:     Carsten Kunze
>Release:        NetBSD 7.99.42 (GENERIC.201611250700Z) amd64
>Organization:
>Environment:
NetBSD 7.99.42 (GENERIC.201611250700Z) amd64
>Description:
printw() does output multibyte strings only correctly when compiled with ASAN.  This likely indicates a curses internal data corruption which has no effect with the different memory layout used by ASAN.
>How-To-Repeat:
Below a Makefile and a C file is shown.

The output is "äöüÃ" when compiled with the comment in the Makefile and "äöüß" without the comment.

$ cat Makefile                                                                                                                                                                                 
LDFLAGS=-lcurses
CFLAGS=-g #-fsanitize=address

all: main

clean:
        rm -f main

$ cat main.c                                                                                                                                                                                   
#include <locale.h>
#include <curses.h>

int
main()
{
        char *mbs = "äöüß";

        setlocale(LC_ALL, "");
        initscr();
        printw("%s\n", mbs);
        refresh();
        getch();
        endwin();
        return 0;
}


>Fix:



Home | Main Index | Thread Index | Old Index