[Pixman] [PATCH] Trying to reproduce bug #97938

Alessandro Vesely vesely at tana.it
Wed Oct 5 18:25:51 UTC 2016


See https://bugs.freedesktop.org/show_bug.cgi?id=97938

I'm not sure the image I pass is valid; if not, that would be a Cairo
bug or something in between.  Tomorrow I'll send more patches.

Ciao
Ale

Signed-off-by: Alessandro Vesely <vesely at tana.it>
---
 test/large-test.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)
 create mode 100644 test/large-test.c

diff --git a/test/large-test.c b/test/large-test.c
new file mode 100644
index 0000000..bf9095a
--- /dev/null
+++ b/test/large-test.c
@@ -0,0 +1,77 @@
+#include <stdlib.h>
+#include "utils.h"
+
+#if 0
+static void
+on_destroy (pixman_image_t *image, void *data)
+{
+    free (data);
+}
+
+pixman_image_set_destroy_function (image, on_destroy, orig);
+#endif
+
+static pixman_image_t *
+make_image (pixman_format_code_t format, size_t width, size_t height)
+{
+    uint32_t *bytes, *orig;
+    pixman_image_t *image;
+    int stride;
+
+    size_t size = width * height * 4UL;
+    orig = bytes = calloc (1, size);
+    if (!orig)
+    {
+    	puts("failed");
+    	return NULL;
+    }
+    prng_randmemset (bytes, size, 0);
+
+    stride = width * 4;
+    image = pixman_image_create_bits (
+	format, width, height, bytes, stride);
+
+    pixman_image_set_repeat (image, PIXMAN_REPEAT_NONE);
+
+    image_endian_swap (image);
+    return image;
+}
+
+static uint32_t
+run_test(int testnum, int verbose)
+{
+    static const pixman_transform_t transform =
+	{{{2476867, 0, 84}, {0, 2476867, 44980853}, {0, 0, 65536}}};
+
+    pixman_image_t *src, *mask, *dest;
+
+    prng_srand(testnum);
+
+    /*
+    * This is meant to be similar to a call from
+    * cairo-1.14.0/src/cairo-image-compositor.c:2496
+    */
+    src = make_image(PIXMAN_a8r8g8b8, 19866, 28087);
+    pixman_image_set_transform (src, &transform);
+    mask = make_image(PIXMAN_a8, 528, 32);
+    dest = make_image(PIXMAN_a8r8g8b8, 526, 32);
+    pixman_image_composite32(PIXMAN_OP_SRC,
+                             src,
+                             mask,
+                             dest,
+                             0     /* src_x  */,
+                             693   /* src_y  */,
+                             0     /* mask_x */,
+                             0     /* mask_y */,
+                             0     /* dest_x */,
+                             0     /* dest_y */,
+                             525   /* width  */,
+                             32    /* height */);
+    return 1;
+}
+
+int
+main (int argc, const char *argv[])
+{
+    return fuzzer_test_main ("large", 1, 1, run_test, argc, argv);
+}
-- 
2.1.4



More information about the Pixman mailing list