Pasting illegal character causes segmentation fault

Mitja mitja_ursic at yahoo.com
Fri Dec 25 14:26:56 PST 2009


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 +++

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();
}

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.


Frank Benoit Wrote:

> Am 25.12.2009 13:22, schrieb Mitja:
> > When I paste illegal character (looks like rectangle) in Text widget,
> > application exits with segmentation fault. I cannot catch bad character with Verify Listener, because it's already too late. Is there any other way to detect it?
> > 
> > Platform is Debian 5.0.3 (lenny), DMD v1.033.
> 
> Can you give a stack trace, the exact character you pasted and perhaps a
> compilable small example code to reproduce the bug?



More information about the Digitalmars-d-dwt mailing list