diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-01-05 19:33:21 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-01-05 21:23:46 +0000 |
commit | 481fd3b4c8d3972ce21399f81b2021a57ed58f00 (patch) | |
tree | 25f788425cafa6df3bed4f7e9ac1936f0f941fc4 /src/cairo-traps.c | |
parent | be126b6842e979dbcb306b2f9f41a2114a149b9a (diff) | |
download | cairo-481fd3b4c8d3972ce21399f81b2021a57ed58f00.tar.gz |
[cairo-traps] Return zero extents if it contains no traps.
Previously, _cairo_traps_extents () returned the extents
p1={INT_MAX, INT_MAX} p2={INT_MIN, INT_MIN} for an empty traps leading
to integer overflow when computing the width using p2-p1 and causing
further overflows within libpixman. [For example this caused the
allocation of massive regions with test/mask and the PS backend.]
Diffstat (limited to 'src/cairo-traps.c')
-rw-r--r-- | src/cairo-traps.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cairo-traps.c b/src/cairo-traps.c index d5e75320f..41e18e978 100644 --- a/src/cairo-traps.c +++ b/src/cairo-traps.c @@ -568,7 +568,11 @@ _cairo_traps_contain (cairo_traps_t *traps, double x, double y) void _cairo_traps_extents (cairo_traps_t *traps, cairo_box_t *extents) { - *extents = traps->extents; + if (traps->num_traps == 0) { + extents->p1.x = extents->p1.y = _cairo_fixed_from_int (0); + extents->p2.y = extents->p2.y = _cairo_fixed_from_int (0); + } else + *extents = traps->extents; } /** |