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
This commit is contained in:
Mike Blumenkrantz 2019-07-18 19:21:26 +02:00 committed by Xavi Artigas
parent 89db9df2d2
commit 2196e1bf7c
1 changed files with 2 additions and 1 deletions

View File

@ -1232,7 +1232,8 @@ static inline double
_scroll_manager_animation_duration_get(Evas_Coord dx, Evas_Coord dy)
{
double dist = 0.0, vel = 0.0, dur = 0.0;
dist = sqrt(dx * dx + dy *dy);
uint64_t x = abs(dx), y = abs(dy);
dist = sqrt(x * x + y * y);
vel = _elm_config->thumbscroll_friction_standard / _elm_config->thumbscroll_friction;
dur = dist / vel;
dur = (dur > _elm_config->thumbscroll_friction) ? _elm_config->thumbscroll_friction : dur;