From 1755694357faa12d2f9c83c8513d770bb1b2d2f4 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Tue, 4 Dec 2012 03:51:18 +0000 Subject: [PATCH] elementary: fix potential divide by zero in els_scroller.c SVN revision: 80124 --- ChangeLog | 6 +++++- NEWS | 1 + src/lib/els_scroller.c | 6 ++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2014252..177a973 100644 --- a/ChangeLog +++ b/ChangeLog @@ -742,4 +742,8 @@ 2012-12-02 Mike Blumenkrantz - * Fix case where tooltips could go offscreen unnecessarily + * Fix case where tooltips could go offscreen unnecessarily. + +2012-12-04 Cedric Bail + + * Fix a possible divide by zero in els_scroller animator. diff --git a/NEWS b/NEWS index 553f315..d38d7fe 100644 --- a/NEWS +++ b/NEWS @@ -71,6 +71,7 @@ Fixes: * Fix the naviframe to resize it's items which are inserted. * Fix the naviframe to send signal emits one time for content show/hide, text show/hide. * Fix case where tooltips could go offscreen unnecessarily + * Fix possible divide by zero in els_scroller animator. Removals: diff --git a/src/lib/els_scroller.c b/src/lib/els_scroller.c index 8ee0c64..0c215c2 100644 --- a/src/lib/els_scroller.c +++ b/src/lib/els_scroller.c @@ -2124,14 +2124,16 @@ _smart_hold_animator(void *data) while ((pos[src_index].t < time_interval * i) && (src_index <= count)) { src_index++; - } + } if (src_index <= count) - { + { xsum += pos[src_index].x; ysum += pos[src_index].y; dst_index++; } } + /* Note: difficult to trigger, but may be possible to get src_index == 0 and count < 0 and so trigger a divide by zero. */ + if (!dst_index) dst_index = 1; fx = xsum / dst_index; fy = ysum / dst_index; } -- 2.7.4