[cairo] static array allocation caused a segfault

qiuhqing qiuhqing at gmail.com
Fri Nov 9 20:08:08 PST 2007


Hi,

The following program caused repeatable segfaults on my system.
It's a Debian unstable, up-to-date, running Linux 2.6.22-2-686.

I'm not an experienced programmer. But the program compiles
and it's pretty small so I can't find if it's my programming error or else.
Please let me know! Thank you! The unused variable thing is because I
extracted it from a program I'm working on...

----8<----
/*

gcc -Wall -Wextra -o cairo-bug cairo-bug.c \
`pkg-config --cflags --libs cairo-png`

*/

#include <cairo.h>

int main(void)
{
    // if we remove the allocation, program runs and $? is 0.
    // however, program segfaults if the next line is in.
    double rgb[805*805*3];

    cairo_surface_t *surface = cairo_image_surface_create(
        CAIRO_FORMAT_ARGB32,
        805,
        805
    );
    return 0;
}



More information about the cairo mailing list