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.
This commit is contained in:
Søren Sandmann Pedersen 2012-12-13 15:26:17 -05:00
parent 1f0c02811e
commit c2cb303d33
2 changed files with 3 additions and 0 deletions

View File

@ -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);

View File

@ -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;