summaryrefslogtreecommitdiff
path: root/src/sna/sna_accel.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-05-24 11:02:20 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-05-24 11:03:42 +0100
commit2005b273e10f2b946f79c602b55a7bf585c936de (patch)
treec7aa6c3c635f3f2045db9d8702f9146a39dd9818 /src/sna/sna_accel.c
parentee7ea10148b7843091c3fa103f9f4476979f8b68 (diff)
sna: Check for NULL damage before dereferencing
Fixes regression from commit 16a64649e9c440ab9457467fe04be25719a73e7c [2.21.7] Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Fri May 10 15:48:58 2013 +0100 sna: Basic copy-on-write support for cloning pixmaps Reported-by: Axel Rohde Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_accel.c')
-rw-r--r--src/sna/sna_accel.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 49d0ba35..ef950493 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2716,9 +2716,13 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl
unsigned cow = MOVE_READ;
if ((flags & MOVE_READ) == 0) {
- r.extents = *box;
- r.data = NULL;
- if (region_subsumes_damage(&r, priv->gpu_damage))
+ if (priv->gpu_damage) {
+ r.extents = *box;
+ r.data = NULL;
+ if (region_subsumes_damage(&r,
+ priv->gpu_damage))
+ cow = 0;
+ } else
cow = 0;
}
@@ -2961,15 +2965,19 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box,
unsigned cow = MOVE_READ;
if (flags & IGNORE_CPU) {
- get_drawable_deltas(drawable, pixmap, &dx, &dy);
-
- region.extents = *box;
- region.extents.x1 += dx;
- region.extents.x2 += dx;
- region.extents.y1 += dy;
- region.extents.y2 += dy;
- region.data = NULL;
- if (region_subsumes_damage(&region, priv->gpu_damage))
+ if (priv->gpu_damage) {
+ get_drawable_deltas(drawable, pixmap, &dx, &dy);
+
+ region.extents = *box;
+ region.extents.x1 += dx;
+ region.extents.x2 += dx;
+ region.extents.y1 += dy;
+ region.extents.y2 += dy;
+ region.data = NULL;
+ if (region_subsumes_damage(&region,
+ priv->gpu_damage))
+ cow = 0;
+ } else
cow = 0;
}