elementary: fix potential divide by zero in els_scroller.c
authorCedric BAIL <cedric.bail@free.fr>
Tue, 4 Dec 2012 03:51:18 +0000 (03:51 +0000)
committerCedric BAIL <cedric.bail@free.fr>
Tue, 4 Dec 2012 03:51:18 +0000 (03:51 +0000)
SVN revision: 80124

ChangeLog
NEWS
src/lib/els_scroller.c

index 2014252..177a973 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
 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 (file)
--- 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:
 
index 8ee0c64..0c215c2 100644 (file)
@@ -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;
      }