Pasting illegal character causes segmentation fault

Frank Benoit keinfarbton at googlemail.com
Fri Dec 25 14:49:49 PST 2009


Am 25.12.2009 23:26, schrieb Mitja:
> strace output:
> select(4, [3], [3], NULL, NULL)         = 1 (out [3])
> writev(3, [{"\24\0\6\0005\2@\5\343\2\0\0\0\0\0\0\0\0\0\0\377\377\377\37"..., 24}], 1) = 24
> select(4, [3], [], NULL, NULL)          = 1 (in [3])
> read(3, "\1\10S6\4\0\0\0006\1\0\0\0\0\0\0\17\0\0\0VJ\25\10\374\325 \10tc\346\277\203"..., 4096) = 48
> read(3, 0x840a2fc, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
> select(4, [3], [3], NULL, NULL)         = 1 (out [3])
> writev(3, [{"+\0\1\0"..., 4}], 1)       = 4
> select(4, [3], [], NULL, NULL)          = 1 (in [3])
> read(3, "\1\2T6\0\0\0\0#\0@\5\374\325 \10tc\346\277x+\177\td\"\36\10Y3\t\10"..., 4096) = 32
> read(3, 0x840a2fc, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
> select(4, [3], [3], NULL, NULL)         = 1 (out [3])
> writev(3, [{"\23\0\3\0005\2@\5\343\2\0\0+\0\1\0"..., 16}], 1) = 16
> select(4, [3], [], NULL, NULL)          = 1 (in [3])
> read(3, "\34\"U65\2@\5\343\2\0\0\0\252Fc\1\2\0\0\4\0\0\0\1\0\0\0 at B\233\t\1"..., 4096) = 64
> read(3, 0x840a2fc, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
> --- SIGSEGV (Segmentation fault) @ 0 (0) ---
> +++ killed by SIGSEGV +++
> 

Oh, i did not mean strace (which is a trace of the OS calls a process
does), instead i mean stack trace. You can perhaps get it with the
current tango (i think) or by running the program in GDC and after the
segfault run the "backtrace" command in it. It show the code line where
the segfault happens and the code lines where this one was called from.


> Example code:
> module text;
> 
> import dwt.DWT;
> import dwt.custom.StyleRange;
> import dwt.widgets.Text;
> import dwt.layout.FillLayout;
> import dwt.widgets.Display;
> import dwt.widgets.Shell;
> 
> void main() {
>     Display display = new Display();
>     Shell shell = new Shell(display);
>     shell.setLayout(new FillLayout());
>     Text text = new Text(shell, DWT.BORDER);
>     shell.pack();
>     shell.open();
>     while (!shell.isDisposed()) {
>       if (!display.readAndDispatch())
>         display.sleep();
>     }
>     display.dispose();
> }
> 

thanks.


> I cannot reproduce the character.
> The way I got it was by pasting block of Japanese or Chinese characters into text widget and then selecting by mouse and copying a few characters from that block.
> Illegal character(s) would as a result of copying appear in Klipper (KDE clipboard), usually in front or at the end of copied selection.
> Segmentation fault would occur when I pasted back the very same selection, now with prepended or appended illegal characters.
> 

Hm, perhaps you can paste the same into a editor and open it with a
hex-view (hexdump) to make the byte values visible.



More information about the Digitalmars-d-dwt mailing list