[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: wget_wch problem
From: |
Thomas Dickey |
Subject: |
Re: wget_wch problem |
Date: |
Wed, 14 Jan 2004 05:55:10 -0500 (EST) |
On Wed, 14 Jan 2004, Saravanan Bellan wrote:
> When running the following program on Solaris 8 with
> ncurses(ncurses-5.3-20031004-patch) and zh_CN.GB18030 I get a seg fault at
> wget_wch (stack trace below)
perhaps linking against libncurses_g would give more information.
Is this with Sun's locale support, or using libiconv?
I may be able to test the latter on Linux.
Reading the code, I suspect a buffer overflow - since the buffer
into which mbrtowc writes is fixed (I should alter that).
> It works fine for any other locale.
>
> Any ideas.
>
> #include <signal.h>
> #include <locale.h>
> #include <curses.h>
> #include <errno.h>
> #include <stddef.h>
>
> main(int argc, char ** argv) {
> WINDOW *win;
> wint_t in_wc;
> int ret_c;
>
> initscr(); nonl(); noecho(); raw(); erase(); refresh();
>
> setlocale(LC_ALL, "");
>
> win = newwin(20, 60, 0, 0);
>
> clearok(win, 1); touchwin(win); wrefresh(win);
> do {
> errno = 0;
> ret_c = wget_wch(win, &in_wc);
> } while ((ret_c == ERR) && (errno == EINTR));
> noraw();
> endwin();
> }
>
> The back trace from gdb,
>
> Program terminated with signal 11, Segmentation Fault.
> Loaded symbols for /usr/lib/locale/zh_CN.GB18030/methods_zh_CN.GB18030.so.2
> (gdb) bt
> #0 0xff3516e4 in __mbrtowc_dense_gb18030 ()
> from /usr/lib/locale/zh_CN.GB18030/methods_zh_CN.GB18030.so.2
> #1 0x1d718 in wget_wch ()
> #2 0x12e58 in main (argc=1, argv=0xffbef62c) at wget.c:21
>
>
> Thanks,
> -Sarva
>
>
> _______________________________________________
> Bug-ncurses mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-ncurses
>
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
- wget_wch problem, Saravanan Bellan, 2004/01/14
- Re: wget_wch problem,
Thomas Dickey <=