summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-04 02:38:16 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-04 02:38:16 +0000
commit3449f1cbe184a618e662d2a662167f05362b82e5 (patch)
tree6a286cd434f0cdf18ca51559260e0645b9a721a2
parent04a6260016fb5ebefc1056ed6acf5001ec535d5c (diff)
sna: Guard against NULL damage deref
The fast version of damage checking assumes that the damage has already been determined to be non-NULL, so make sure it is. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 186041fe..ab975a9d 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1296,7 +1296,9 @@ _sna_drawable_use_cpu_bo(DrawablePtr drawable,
done:
*damage = &priv->cpu_damage;
- if (sna_damage_contains_box__no_reduce(priv->cpu_damage, &extents))
+ if (priv->cpu_damage &&
+ (priv->cpu_damage->mode == DAMAGE_ALL ||
+ sna_damage_contains_box__no_reduce(priv->cpu_damage, &extents)))
*damage = NULL;
return TRUE;