Skip to content

Commit 04ba6d0

Browse files
committed
Make sure Region handles invalid rectangles
the boolean operation code assumes rects are valid and could go into an infinite loop if not. make sure we abort before that happens. Bug: 5331198, 5334829 Change-Id: I8aa42b2e0b37238ec2434b794dd84c1a1b70f163
1 parent 892ac41 commit 04ba6d0

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

libs/ui/Region.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,11 @@ void Region::boolean_operation(int op, Region& dst,
479479
const Region& lhs,
480480
const Rect& rhs, int dx, int dy)
481481
{
482+
if (!rhs.isValid()) {
483+
LOGE("Region::boolean_operation(op=%d) invalid Rect={%d,%d,%d,%d}",
484+
op, rhs.left, rhs.top, rhs.right, rhs.bottom);
485+
}
486+
482487
#if VALIDATE_WITH_CORECG || VALIDATE_REGIONS
483488
boolean_operation(op, dst, lhs, Region(rhs), dx, dy);
484489
#else

0 commit comments

Comments
 (0)