[GRASS-dev] [bug #5037] (grass) GRASS 6.3: d.graph segfault

Request Tracker grass-bugs at intevation.de
Wed Aug 23 08:03:57 EDT 2006


this bug's URL: http://intevation.de/rt/webrt?serial_num=5037
-------------------------------------------------------------------------

Subject: GRASS 6.3: d.graph segfault

Hi,

d.graph segfaults on startup. (GRASS 6.3-cvs only)

in lib/raster/com_proto.c  R_RGB_color()


e.g.

G63> d.mon x0
G63> echo "draw 50 50" | d.graph
Segmentation fault

It breaks due to bad translation of the color=black default option.
    int R,G,B,color;

        /* Parse and select color */
        if (opt2->answer != NULL) {
            color = G_str_to_color(opt2->answer, &R, &G, &B);

            if(color == 0)
                G_fatal_error(_("[%s]: No such color"), opt2->answer);

            if(color == 1) {
                R_RGB_color(R, G, B);
                set_last_color(R, G, B, RGBA_COLOR_OPAQUE);
            }
            else /* (color==2) is "none" */
                set_last_color(0, 0, 0, RGBA_COLOR_NONE);
        }


R,G,B is populated and passed to R_RGB_color(). R_RGB_color() is expecting
unsigned char, and segfaults as it thinks int 0 is '\0' ?????


(gdb) bt full
#0  0x400a144d in R_RGB_color (red=0 '\0', grn=0 '\0', blu=0 '\0') at
com_proto.c:166
No locals.
#1  0x0804ac65 in main (argc=2, argv=0xbffff6f4) at main.c:81
        window_name =
"\000÷ÿ¿töÿ¿\232;\000@ l\001Aà­\004\b(Æ\004\bxöÿ¿=\221\004\b\234\001\000 at Xï\n@\230öÿ¿û­\004\bÀ\210\024A@®\004\bôöÿ¿À\210\024A"
        module = (struct GModule *) 0x4005be50
        opt1 = (struct Option *) 0x4005be00
        opt2 = (struct Option *) 0x804c7d0
        mapcoords = (struct Flag *) 0x4005bdd8
        R = 0
        G = 0
        B = 0
        color = 1




thanks,
Hamish


-------------------------------------------- Managed by Request Tracker




More information about the grass-dev mailing list