pixman: Branch 'master'

Søren Sandmann Pedersen sandmann at kemper.freedesktop.org
Wed Jun 24 08:05:46 PDT 2009


 test/Makefile.am |    2 ++
 test/oob-test.c  |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)

New commits:
commit bed9c378ff9d01c8e646241dd96a43e2eb870cca
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Wed Jun 24 10:37:07 2009 -0400

    Add test case for out-of-bounds memory access.

diff --git a/test/Makefile.am b/test/Makefile.am
index 2590617..cfe367e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -5,12 +5,14 @@ TESTPROGRAMS =			\
 	region-test		\
 	scaling-test		\
 	fetch-test		\
+	oob-test		\
 	trap-crasher
 
 fetch_test_LDADD = $(TEST_LDADD)
 region_test_LDADD = $(TEST_LDADD)
 scaling_test_LDADD = $(TEST_LDADD)
 trap_crasher_LDADD = $(TEST_LDADD)
+oob_test_LDADD = $(TEST_LDADD)
 
 # GTK using test programs
 
diff --git a/test/oob-test.c b/test/oob-test.c
new file mode 100644
index 0000000..fbcb537
--- /dev/null
+++ b/test/oob-test.c
@@ -0,0 +1,36 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "pixman.h"
+#include "utils.h"
+
+int
+main (int argc, char **argv)
+{
+#define DWIDTH 3
+#define DHEIGHT 6
+#define DSTRIDE 16
+
+#define SWIDTH 5
+#define SHEIGHT 7
+#define SSTRIDE 20
+    
+    uint32_t *src = malloc (DHEIGHT * SSTRIDE);
+    uint32_t *dest = malloc (DHEIGHT * DSTRIDE);
+    pixman_image_t *simg, *dimg;
+
+    int i;
+
+    for (i = 0; i < (SHEIGHT * SSTRIDE) / 4; ++i)
+	src[i] = 0x7f007f00;
+
+    for (i = 0; i < (DHEIGHT * DSTRIDE) / 4; ++i)
+	dest[i] = 0;
+
+    simg = pixman_image_create_bits (PIXMAN_a8r8g8b8, SWIDTH, SHEIGHT, src, SSTRIDE);
+    dimg = pixman_image_create_bits (PIXMAN_x8r8g8b8, DWIDTH, DHEIGHT, dest, DSTRIDE);
+
+    pixman_image_composite (PIXMAN_OP_SRC, simg, NULL, dimg,
+			    1, 8, 0, 0, 1, -1, 1, 8);
+
+    return 0;
+}


More information about the xorg-commit mailing list