Use clampTo<int> in SVGInteger::CalculateAnimatedValue
Matches what we do in SVGIntegerOptionalInteger::CalculateAnimatedValue,
and avoids undefined overflow.
Bug: 899445
Change-Id: I1250a05482713780f707301ed29e015fd81e65f2
Reviewed-on: https://chromium-review.googlesource.com/c/1304483
Reviewed-by: Stephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#603548}
diff --git a/third_party/blink/renderer/core/svg/svg_integer.cc b/third_party/blink/renderer/core/svg/svg_integer.cc
index e8f277e..a160403c 100644
--- a/third_party/blink/renderer/core/svg/svg_integer.cc
+++ b/third_party/blink/renderer/core/svg/svg_integer.cc
@@ -79,7 +79,7 @@
animation_element->AnimateAdditiveNumber(
percentage, repeat_count, from_integer->Value(), to_integer->Value(),
to_at_end_of_duration_integer->Value(), animated_float);
- value_ = static_cast<int>(roundf(animated_float));
+ value_ = clampTo<int>(roundf(animated_float));
}
float SVGInteger::CalculateDistance(SVGPropertyBase* other, SVGElement*) {