Add workarounds for X servers doing out-of-bounds accesses.
authorSøren Sandmann Pedersen <sandmann@redhat.com>
Thu, 9 Jul 2009 05:35:11 +0000 (01:35 -0400)
committerSøren Sandmann Pedersen <sandmann@redhat.com>
Fri, 10 Jul 2009 06:57:09 +0000 (02:57 -0400)
commit0fce356762864572ae126733f657600fbb9116ce
treea442f33e6f2f5b9574496f9b091d69e2ec1e9212
parent61254a3c09497214a9c7ca89e275286533a3be2e
Add workarounds for X servers doing out-of-bounds accesses.

Old X servers rely on out-of-bounds accesses when they are asked
to composite with a window as the source. They create a pixman image
pointing to some bogus position in memory, but then they set a clip
region to the position where the actual bits are.

Due to a bug in old versions of pixman, where it would not clip
against the image bounds when a clip region was set, this would
actually work.

The workaround added by this commit is to try and detect whether a
source drawable is actually a window without a client clip set. Such a
window will generally have a clip region that corresponds exactly to
the hierarchy clip in the server, whereas pixmaps will have a clip
region that is an exact match to the drawable.

When we detect such a window, we allow a fast path to run that would
normally be rejected due to the sources not completely subsuming the
composite region.

Fixed X servers should call the new function
pixman_disable_out_of_bounds_workaround() to disable the workaround.

This was reported in bug 22484.
pixman/pixman-utils.c
pixman/pixman.h
test/scaling-test.c