[cairo] static array allocation caused a segfault

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


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


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(
    return 0;

More information about the cairo mailing list