rendercheck: 2 commits - t_bug7366.c

Eric Anholt anholt at kemper.freedesktop.org
Fri Jun 30 13:00:14 EEST 2006


 t_bug7366.c |  151 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 151 insertions(+)

New commits:
diff-tree 2319fc448354c6b965132ada135d38cce8badb9d (from 0b9af7ccf482fb1dafed256f21742eb2a9de56f9)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Fri Jun 30 11:54:13 2006 +0200

    Add a check for setting a filter on a source picture causing a crash.
    (cherry picked from f313b8c4f7bfc2910a55002ba6c8a731796e7d19 commit)

diff --git a/t_bug7366.c b/t_bug7366.c
index d11f616..9084327 100644
--- a/t_bug7366.c
+++ b/t_bug7366.c
@@ -110,6 +110,27 @@ bug7366_test_set_picture_clip_rectangles
     return TRUE;
 }
 
+/**
+ * Check SetPictureFilter on a source potentially causing a crash.
+ */
+static Bool
+bug7366_test_set_picture_filter(Display *dpy)
+{
+    Picture source_pict;
+    XRenderColor color;
+
+    memset(&color, 0, sizeof(color));
+    source_pict = XRenderCreateSolidFill(dpy, &color);
+
+    XRenderSetPictureFilter(dpy, source_pict, "bilinear", NULL, 0);
+    XSync(dpy, FALSE);
+    XSetErrorHandler(NULL);
+
+    XRenderFreePicture(dpy, source_pict);
+
+    return TRUE;
+}
+
 Bool
 bug7366_test(Display *dpy)
 {
@@ -123,6 +144,7 @@ bug7366_test(Display *dpy)
     bug7366_test_set_picture_transform(dpy);
     bug7366_test_set_alpha_map(dpy);
     bug7366_test_set_picture_clip_rectangles(dpy);
+    bug7366_test_set_picture_filter(dpy);
 
     /* If the server isn't gone, then we've succeeded. */
     return TRUE;
diff-tree 0b9af7ccf482fb1dafed256f21742eb2a9de56f9 (from a3c9527030127fe6dd06d1d75207b4e855b93db8)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Fri Jun 30 11:57:35 2006 +0200

    Actually add the tests for bug #7366, and add a couple more crash cases.

diff --git a/t_bug7366.c b/t_bug7366.c
new file mode 100644
index 0000000..d11f616
--- /dev/null
+++ b/t_bug7366.c
@@ -0,0 +1,129 @@
+/*
+ * Copyright © 2006 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Eric Anholt makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "rendercheck.h"
+
+int
+expecting_error(Display *dpy, XErrorEvent *event)
+{
+    return TRUE;
+}
+
+/**
+ * Check SetPictureTransform on a source picture causing a crash.
+ */
+static Bool
+bug7366_test_set_picture_transform(Display *dpy)
+{
+    Picture source_pict;
+    XRenderColor color;
+    XTransform transform;
+
+    memset(&color, 0, sizeof(color));
+    source_pict = XRenderCreateSolidFill(dpy, &color);
+
+    memset(&transform, 0, sizeof(transform));
+    XRenderSetPictureTransform(dpy, source_pict, &transform);
+
+    XSync(dpy, FALSE);
+
+    XRenderFreePicture(dpy, source_pict);
+
+    return TRUE;
+}
+
+/**
+ * Check setting of AlphaMap to a source picture causing a crash.
+ */
+static Bool
+bug7366_test_set_alpha_map(Display *dpy)
+{
+    Picture source_pict, pict;
+    XRenderColor color;
+    Drawable pixmap;
+    XRenderPictureAttributes pa;
+
+    memset(&color, 0, sizeof(color));
+    source_pict = XRenderCreateSolidFill(dpy, &color);
+
+    pixmap = XCreatePixmap(dpy, RootWindow(dpy, 0), 1, 1, 32);
+    pict = XRenderCreatePicture(dpy, pixmap,
+        XRenderFindStandardFormat(dpy, PictStandardARGB32), 0, NULL);
+
+    XSetErrorHandler(expecting_error);
+    pa.alpha_map = source_pict;
+    XRenderChangePicture(dpy, pict, CPAlphaMap, &pa);
+    XSync(dpy, FALSE);
+    XSetErrorHandler(NULL);
+
+    XFreePixmap(dpy, pixmap);
+    XRenderFreePicture(dpy, pict);
+    XRenderFreePicture(dpy, source_pict);
+
+    return TRUE;
+}
+
+/**
+ * Check SetPictureClipRectangles on a source potentially causing a crash.
+ */
+static Bool
+bug7366_test_set_picture_clip_rectangles(Display *dpy)
+{
+    Picture source_pict;
+    XRenderColor color;
+    XRectangle rectangle;
+
+    memset(&color, 0, sizeof(color));
+    source_pict = XRenderCreateSolidFill(dpy, &color);
+
+    memset(&rectangle, 0, sizeof(rectangle));
+    XSetErrorHandler(expecting_error);
+    XRenderSetPictureClipRectangles(dpy, source_pict, 0, 0, &rectangle, 1);
+    XSync(dpy, FALSE);
+    XSetErrorHandler(NULL);
+
+    XRenderFreePicture(dpy, source_pict);
+
+    return TRUE;
+}
+
+Bool
+bug7366_test(Display *dpy)
+{
+    int maj, min;
+
+    /* Make sure we actually have gradients available */
+    XRenderQueryVersion(dpy, &maj, &min);
+    if (maj != 0 || min < 10)
+	return TRUE;
+
+    bug7366_test_set_picture_transform(dpy);
+    bug7366_test_set_alpha_map(dpy);
+    bug7366_test_set_picture_clip_rectangles(dpy);
+
+    /* If the server isn't gone, then we've succeeded. */
+    return TRUE;
+}



More information about the xorg-commit mailing list