Disallow negative radii in deserialized SkRRects
bug= chromium:787124 Change-Id: I232ccd6bdfc2c176f97b97e24eabad6a9ce8e5e2 Reviewed-on: https://skia-review.googlesource.com/73901 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
f8fa50f099
commit
4b0e364f92
@ -530,7 +530,8 @@ void SkRRect::dump(bool asHex) const {
|
||||
* We need all combinations of predicates to be true to have a "safe" radius value.
|
||||
*/
|
||||
static bool are_radius_check_predicates_valid(SkScalar rad, SkScalar min, SkScalar max) {
|
||||
return (min <= max) && (rad <= max - min) && (min + rad <= max) && (max - rad >= min);
|
||||
return (min <= max) && (rad <= max - min) && (min + rad <= max) && (max - rad >= min) &&
|
||||
rad >= 0;
|
||||
}
|
||||
|
||||
bool SkRRect::isValid() const {
|
||||
|
@ -786,6 +786,8 @@ static void test_read(skiatest::Reporter* reporter) {
|
||||
test_read_rrect(reporter, rrect, false);
|
||||
*innerRadius = SK_ScalarNaN;
|
||||
test_read_rrect(reporter, rrect, false);
|
||||
*innerRadius = -10.f;
|
||||
test_read_rrect(reporter, rrect, false);
|
||||
}
|
||||
|
||||
DEF_TEST(RoundRect, reporter) {
|
||||
|
Loading…
Reference in New Issue
Block a user