diff options
author | M Joonas Pihlaja <jpihlaja@cc.helsinki.fi> | 2009-09-03 19:18:07 +0300 |
---|---|---|
committer | M Joonas Pihlaja <jpihlaja@cc.helsinki.fi> | 2009-09-03 19:27:24 +0300 |
commit | 9e45673e197d0f43e296483cc6b5ca6df94e7f02 (patch) | |
tree | 0373403303cc677f2e7c022e0103ae73a7d1fde3 /test/large-source.c | |
parent | 12d0613210547b8a50dd7b21a12eb1485ee496b9 (diff) | |
download | cairo-9e45673e197d0f43e296483cc6b5ca6df94e7f02.tar.gz |
[image] Check for out of bounds image surface sizes in constructors.
The image surface code doesn't reliably work on images larger than
32767 in width or height. This patch makes the image surface
constructors fail by returning a surface in the CAIRO_STATUS_INVALID_SIZE
state when given negative or too large dimensions so that client code
gets a prompt and correct error rather than flaky rendering on large
images.
Diffstat (limited to 'test/large-source.c')
-rw-r--r-- | test/large-source.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/large-source.c b/test/large-source.c index 5b2254cc2..b02b493a5 100644 --- a/test/large-source.c +++ b/test/large-source.c @@ -49,7 +49,7 @@ draw (cairo_t *cr, int width, int height) cairo_set_source_rgb (cr, 0, 0, 1); /* blue */ cairo_paint (cr); - surface = cairo_image_surface_create (CAIRO_FORMAT_A1, 64000, 20); + surface = cairo_image_surface_create (CAIRO_FORMAT_A1, 32000, 20); data = cairo_image_surface_get_data (surface); if (data != NULL) { int stride = cairo_image_surface_get_stride (surface); @@ -68,7 +68,7 @@ draw (cairo_t *cr, int width, int height) cairo_mask_surface (cr, surface, 0, 0); cairo_surface_destroy (surface); - surface = cairo_image_surface_create (CAIRO_FORMAT_A1, 20, 64000); + surface = cairo_image_surface_create (CAIRO_FORMAT_A1, 20, 32000); data = cairo_image_surface_get_data (surface); if (data != NULL) { int stride = cairo_image_surface_get_stride (surface); |