summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2016-05-26 19:01:59 +0900
committerAdam Jackson <ajax@redhat.com>2016-07-06 13:21:27 -0400
commite02d2174570e42800c21a2205f83dd286881469f (patch)
tree2edf2c9b07fba4da7057e91b0b4bd199a5901522
parentf5b224a0e20f1d44d4ab1aeeddbb4e2d40dec998 (diff)
glamor: Cannot use copies when accessing outside of composite source
Commit b64108fa ("glamor: Check for composite operations which are equivalent to copies") failed to copy conditions from exaComposite which ensure that the composite operation doesn't access outside of the source picture. This fixes rendercheck regressions from the commit above. Reviewed-by: Keith Packard <keithp@keithp.com> (cherry picked from commit 5ff75da317539e87cca429185d710d0eeb9d9222)
-rw-r--r--glamor/glamor_render.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index 91e299954..d70316d36 100644
--- a/glamor/glamor_render.c
+++ b/glamor/glamor_render.c
@@ -1422,18 +1422,21 @@ glamor_composite_clipped_region(CARD8 op,
if (!mask && !source->alphaMap && !dest->alphaMap
&& source->pDrawable && !source->transform
&& ((op == PictOpSrc
- && ((source->format == dest->format
- || (PICT_FORMAT_COLOR(dest->format)
- && PICT_FORMAT_COLOR(source->format)
- && dest->format == PICT_FORMAT(PICT_FORMAT_BPP(source->format),
- PICT_FORMAT_TYPE(source->format),
- 0,
- PICT_FORMAT_R(source->format),
- PICT_FORMAT_G(source->format),
- PICT_FORMAT_B(source->format))))
- || (op == PictOpOver
- && source->format == dest->format
- && !PICT_FORMAT_A(source->format)))))) {
+ && (source->format == dest->format
+ || (PICT_FORMAT_COLOR(dest->format)
+ && PICT_FORMAT_COLOR(source->format)
+ && dest->format == PICT_FORMAT(PICT_FORMAT_BPP(source->format),
+ PICT_FORMAT_TYPE(source->format),
+ 0,
+ PICT_FORMAT_R(source->format),
+ PICT_FORMAT_G(source->format),
+ PICT_FORMAT_B(source->format)))))
+ || (op == PictOpOver
+ && source->format == dest->format
+ && !PICT_FORMAT_A(source->format)))
+ && x_source >= 0 && y_source >= 0
+ && (x_source + width) <= source->pDrawable->width
+ && (y_source + height) <= source->pDrawable->height) {
x_source += source->pDrawable->x;
y_source += source->pDrawable->y;
x_dest += dest->pDrawable->x;