summaryrefslogtreecommitdiff
path: root/test/large-source.c
diff options
context:
space:
mode:
authorM Joonas Pihlaja <jpihlaja@cc.helsinki.fi>2009-09-03 19:18:07 +0300
committerM Joonas Pihlaja <jpihlaja@cc.helsinki.fi>2009-09-03 19:27:24 +0300
commit9e45673e197d0f43e296483cc6b5ca6df94e7f02 (patch)
tree0373403303cc677f2e7c022e0103ae73a7d1fde3 /test/large-source.c
parent12d0613210547b8a50dd7b21a12eb1485ee496b9 (diff)
downloadcairo-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.c4
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);