DescriptionFix overflow/underflow in ui/gfx once and for all
ui/gfx/geometry currently has a number of spots where adding or
subtracting two integers can cause overflow or underflow. Fix this so
that Point/Vector2d/Size/Rect all correctly clamp integer arithmetic to
not fall into undefined overflow or underflow.
The behavior is now that any operation that would have overflowed or
underflowed is now clamped to the max or min integer. Additionally, for
rects, if their size is large enough to overflow right/bottom, this will
also be clamped.
gfx::Insets is left unchanged as it is only used by ui/views and so is
much more likely to be under user control and not overflow.
This patch also fixes an overflow error in the unit test that happened
in Rect::Inset.
BUG=648214
Committed: https://crrev.com/8c14bf7d37bec879a5caa162f2c72a303da1a6e0
Cr-Commit-Position: refs/heads/master@{#423243}
Patch Set 1 #
Total comments: 2
Patch Set 2 : Move to safe integer conversions header #Patch Set 3 : Now with more tests #
Total comments: 3
Patch Set 4 : Add additional inset test #
Total comments: 2
Patch Set 5 : Fix gn check error #Patch Set 6 : Whitespace #Patch Set 7 : Fix for GCC #Patch Set 8 : Now with 'fix' for accessibility interactive ui test #
Total comments: 2
Patch Set 9 : Remove accessibility test changes #
Messages
Total messages: 42 (26 generated)
|