summaryrefslogtreecommitdiff
path: root/pixman
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2012-12-13 15:26:17 -0500
committerSøren Sandmann Pedersen <ssp@redhat.com>2012-12-13 16:10:41 -0500
commitc2cb303d33ec11390b93cabd90f0f95bc9264113 (patch)
treeac090e79834fcbcb265607cedadeedbe3d5acf6e /pixman
parent1f0c02811ea71b36380b9d4029a248659bd9af50 (diff)
pixman_composite_trapezoids: Return early if mask_format is not of TYPE_ALPHA
stress-test -s 0x17ee crashes because pixman_composite_trapezoids() is given a mask_format of PIXMAN_c8, which causes it to create a temporary image with that format but without a palette. This causes crashes later. The only mask_format that we actually support are those of TYPE_ALPHA, so this patch add a return_if_fail() to ensure this. Similarly, although currently it won't crash if given an invalid format, alpha-only formats have always been the only thing that made sense for the pixman_rasterize_edges() functions, so add a return_if_fail() ensuring that the destination format is of type PIXMAN_TYPE_ALPHA.
Diffstat (limited to 'pixman')
-rw-r--r--pixman/pixman-edge.c1
-rw-r--r--pixman/pixman-trap.c2
2 files changed, 3 insertions, 0 deletions
diff --git a/pixman/pixman-edge.c b/pixman/pixman-edge.c
index 8d498ab..ad6dfc4 100644
--- a/pixman/pixman-edge.c
+++ b/pixman/pixman-edge.c
@@ -374,6 +374,7 @@ pixman_rasterize_edges (pixman_image_t *image,
pixman_fixed_t b)
{
return_if_fail (image->type == BITS);
+ return_if_fail (PIXMAN_FORMAT_TYPE (image->bits.format) == PIXMAN_TYPE_A);
if (image->bits.read_func || image->bits.write_func)
pixman_rasterize_edges_accessors (image, l, r, t, b);
diff --git a/pixman/pixman-trap.c b/pixman/pixman-trap.c
index ab5c8c8..4dad179 100644
--- a/pixman/pixman-trap.c
+++ b/pixman/pixman-trap.c
@@ -491,6 +491,8 @@ pixman_composite_trapezoids (pixman_op_t op,
{
int i;
+ return_if_fail (PIXMAN_FORMAT_TYPE (mask_format) == PIXMAN_TYPE_A);
+
if (n_traps <= 0)
return;