summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-07-18 19:21:26 +0200
committerXavi Artigas <xavierartigas@yahoo.es>2019-07-18 19:22:39 +0200
commit2196e1bf7ce80c6ff62db703aab19d7dc4221883 (patch)
treeeeb2301d1d89beae1321e9ef43c957a57c603a46
parent89db9df2d2fccda8d204e50eb27fcfbe84c90f90 (diff)
efl_ui/scroll_manager: fix int overflow in animation duration calc
Summary: Evas_Coord is a regular int, so this will overflow easily for large scrollers and return NaN for scroll duration and break the scroll Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9355
-rw-r--r--src/lib/elementary/efl_ui_scroll_manager.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/elementary/efl_ui_scroll_manager.c b/src/lib/elementary/efl_ui_scroll_manager.c
index dd924ed0b8..83794319bd 100644
--- a/src/lib/elementary/efl_ui_scroll_manager.c
+++ b/src/lib/elementary/efl_ui_scroll_manager.c
@@ -1232,7 +1232,8 @@ static inline double
1232_scroll_manager_animation_duration_get(Evas_Coord dx, Evas_Coord dy) 1232_scroll_manager_animation_duration_get(Evas_Coord dx, Evas_Coord dy)
1233{ 1233{
1234 double dist = 0.0, vel = 0.0, dur = 0.0; 1234 double dist = 0.0, vel = 0.0, dur = 0.0;
1235 dist = sqrt(dx * dx + dy *dy); 1235 uint64_t x = abs(dx), y = abs(dy);
1236 dist = sqrt(x * x + y * y);
1236 vel = _elm_config->thumbscroll_friction_standard / _elm_config->thumbscroll_friction; 1237 vel = _elm_config->thumbscroll_friction_standard / _elm_config->thumbscroll_friction;
1237 dur = dist / vel; 1238 dur = dist / vel;
1238 dur = (dur > _elm_config->thumbscroll_friction) ? _elm_config->thumbscroll_friction : dur; 1239 dur = (dur > _elm_config->thumbscroll_friction) ? _elm_config->thumbscroll_friction : dur;