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

Commit 7a8fb26c authored by Deepanshu Gupta's avatar Deepanshu Gupta
Browse files

Prevent infinite loop in case of integer overflow.

Bug: 26331754
Change-Id: I29068159204ecd2e03e44fbb2375d2e116774e07
parent a5fcd502
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1752,7 +1752,8 @@ public class GridLayout extends ViewGroup {
            boolean validSolution = true;
            // do a binary search to find the max delta that won't conflict with constraints
            while(deltaMin < deltaMax) {
                final int delta = (deltaMin + deltaMax) / 2;
                // cast to long to prevent overflow.
                final int delta = (int) (((long) deltaMin + deltaMax) / 2);
                invalidateValues();
                shareOutDelta(delta, totalWeight);
                validSolution = solve(getArcs(), a, false);