xartigas pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=2196e1bf7ce80c6ff62db703aab19d7dc4221883

commit 2196e1bf7ce80c6ff62db703aab19d7dc4221883
Author: Mike Blumenkrantz <zm...@samsung.com>
Date:   Thu Jul 18 19:21:26 2019 +0200

    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
---
 src/lib/elementary/efl_ui_scroll_manager.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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
 _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;

-- 


Reply via email to