Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43b4c1e9 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

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
parent 36d2c1f0
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -479,6 +479,11 @@ void Region::boolean_operation(int op, Region& dst,
        const Region& lhs,
        const Region& lhs,
        const Rect& rhs, int dx, int dy)
        const Rect& rhs, int dx, int dy)
{
{
    if (!rhs.isValid()) {
        LOGE("Region::boolean_operation(op=%d) invalid Rect={%d,%d,%d,%d}",
                op, rhs.left, rhs.top, rhs.right, rhs.bottom);
    }

#if VALIDATE_WITH_CORECG || VALIDATE_REGIONS
#if VALIDATE_WITH_CORECG || VALIDATE_REGIONS
    boolean_operation(op, dst, lhs, Region(rhs), dx, dy);
    boolean_operation(op, dst, lhs, Region(rhs), dx, dy);
#else
#else