[cairo-commit] test/image-bug-710072-aligned.ref.png test/image-bug-710072.c test/image-bug-710072-unaligned.ref.png test/image-bug-710072-unaligned.xlib.ref.png test/Makefile.am test/Makefile.sources

Chris Wilson ickle at kemper.freedesktop.org
Sun Feb 6 10:16:03 PST 2011


 test/Makefile.am                             |    3 +
 test/Makefile.sources                        |    1 
 test/image-bug-710072-aligned.ref.png        |binary
 test/image-bug-710072-unaligned.ref.png      |binary
 test/image-bug-710072-unaligned.xlib.ref.png |binary
 test/image-bug-710072.c                      |   80 +++++++++++++++++++++++++++
 6 files changed, 84 insertions(+)

New commits:
commit fda784793edc3da789954df7fc2f0c86d9ed4f94
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Feb 6 18:11:25 2011 +0000

    test: Attempt to capture out-of-bounds spans compositing bug
    
    Attempt to provoke out-of-bounds accesses as demonstrated by
    https://bugs.launchpad.net/ubuntu/+source/cairo/+bug/710072
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/Makefile.am b/test/Makefile.am
index 1648dd8..6a7f11f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -736,6 +736,9 @@ REFERENCE_IMAGES = \
 	huge-radial.ps3.ref.png \
 	huge-radial.quartz.ref.png \
 	huge-radial.ref.png \
+	image-bug-710072-aligned.ref.png \
+	image-bug-710072-unaligned.ref.png \
+	image-bug-710072-unaligned.xlib.ref.png \
 	image-surface-source.image16.ref.png \
 	image-surface-source.ps2.ref.png \
 	image-surface-source.ps3.ref.png \
diff --git a/test/Makefile.sources b/test/Makefile.sources
index 3210745..b666bcd 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -131,6 +131,7 @@ test_sources = \
 	huge-linear.c					\
 	huge-radial.c					\
 	image-surface-source.c				\
+	image-bug-710072.c				\
 	implicit-close.c				\
 	infinite-join.c					\
 	in-fill-empty-trapezoid.c			\
diff --git a/test/image-bug-710072-aligned.ref.png b/test/image-bug-710072-aligned.ref.png
new file mode 100644
index 0000000..42abd20
Binary files /dev/null and b/test/image-bug-710072-aligned.ref.png differ
diff --git a/test/image-bug-710072-unaligned.ref.png b/test/image-bug-710072-unaligned.ref.png
new file mode 100644
index 0000000..13efa30
Binary files /dev/null and b/test/image-bug-710072-unaligned.ref.png differ
diff --git a/test/image-bug-710072-unaligned.xlib.ref.png b/test/image-bug-710072-unaligned.xlib.ref.png
new file mode 100644
index 0000000..0a5a6e6
Binary files /dev/null and b/test/image-bug-710072-unaligned.xlib.ref.png differ
diff --git a/test/image-bug-710072.c b/test/image-bug-710072.c
new file mode 100644
index 0000000..0c9cd8a
--- /dev/null
+++ b/test/image-bug-710072.c
@@ -0,0 +1,80 @@
+/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
+/*
+ * Copyright 2011 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Author: Chris Wilson <chris at chris-wilson.co.uk>
+ */
+
+/*
+ * This test case aims to reproduce the misbehaviour exhibited in
+ * https://bugs.launchpad.net/ubuntu/+source/cairo/+bug/710072
+ * i.e. out of bounds rendering with the rectangular span compositor.
+ */
+
+#include "cairo-test.h"
+
+static cairo_test_status_t
+draw_aligned (cairo_t *cr, int width, int height)
+{
+    cairo_set_source_rgb (cr, 1, 1, 1);
+    cairo_paint (cr);
+
+    cairo_rectangle (cr, -10, -10, 20, 20);
+    cairo_rectangle (cr, 5, 5, 20, 20);
+    cairo_set_source_rgb (cr, 0, 0, 0);
+    cairo_fill_preserve (cr);
+    cairo_set_source_rgba (cr, 1, 0, 0, .5);
+    cairo_stroke (cr);
+
+    return CAIRO_TEST_SUCCESS;
+}
+
+static cairo_test_status_t
+draw_unaligned (cairo_t *cr, int width, int height)
+{
+    cairo_set_source_rgb (cr, 1, 1, 1);
+    cairo_paint (cr);
+
+    cairo_rectangle (cr, -10.5, -10.5, 20, 20);
+    cairo_rectangle (cr, 5.5, 5.5, 20, 20);
+    cairo_set_source_rgb (cr, 0, 0, 0);
+    cairo_fill_preserve (cr);
+    cairo_set_source_rgba (cr, 1, 0, 0, .5);
+    cairo_stroke (cr);
+
+    return CAIRO_TEST_SUCCESS;
+}
+
+CAIRO_TEST (image_bug_710072_aligned,
+	    "Tests a bug where we may compute spans greater than bounded extents",
+	    "extents,fill,stroke", /* keywords */
+	    NULL, /* requirements */
+	    15, 15,
+	    NULL, draw_aligned)
+
+CAIRO_TEST (image_bug_710072_unaligned,
+	    "Tests a bug where we may compute spans greater than bounded extents",
+	    "extents,fill,stroke", /* keywords */
+	    NULL, /* requirements */
+	    15, 15,
+	    NULL, draw_unaligned)


More information about the cairo-commit mailing list