<div dir="ltr"><div>When you call _intersect_rect and pass it an empty rectangle,<br>it creates an invalid region from that rectangle. The only valid<br>empty region is the one where the data pointer points to<br>pixman_region_empty_data. The region created by _intersect_rect has<br>a null data pointer, and so _not_empty returns true for it even if<br>the extents are empty.<br><br>This patch uses code similar to what's in _union_rect to handle empty<br>rectangles.<br>---<br>Â pixman/pixman-region.c | 9 +++++++++<br>Â 1 file changed, 9 insertions(+)<br><br>diff --git a/pixman/pixman-region.c b/pixman/pixman-region.c<br>index 59bc9c7..95911db 100644<br>--- a/pixman/pixman-region.c<br>+++ b/pixman/pixman-region.c<br>@@ -1329,16 +1329,25 @@ PREFIX(_intersect_rect) (region_type_t *dest,<br>Â Â Â Â region_type_t region;<br>Â <br>Â Â Â Â region.data = NULL;<br>Â Â Â Â region.extents.x1 = x;<br>Â Â Â Â region.extents.y1 = y;<br>Â Â Â Â region.extents.x2 = x + width;<br>Â Â Â Â region.extents.y2 = y + height;<br>Â <br>+Â Â Â if (!GOOD_RECT (®ion.extents))<br>+Â Â Â {<br>+Â Â Â Â Â Â Â if (BAD_RECT (®ion.extents))<br>+Â Â Â Â Â Â Â Â Â Â Â _pixman_log_error (FUNC, "Invalid rectangle passed");<br>+Â Â Â Â Â Â Â FREE_DATA (dest);<br>+Â Â Â Â Â Â Â PREFIX (_init) (dest);<br>+Â Â Â Â Â Â Â return TRUE;<br>+Â Â Â }<br>+<br>Â Â Â Â return PREFIX(_intersect) (dest, source, ®ion);<br>Â }<br>Â <br>Â /* Convenience function for performing union of region with a<br>Â * single rectangle<br>Â */<br>Â */<br>Â PIXMAN_EXPORT pixman_bool_t<br>Â PREFIX (_union_rect) (region_type_t *dest,<br>-- <br>2.7.0<br><br></div></div>