Hi,
Issue found by Coverity Scan.
CID 210583 (#1 of 1): Division or modulo by zero (DIVIDE_BY_ZERO)
. divide_by_zero: In expression time_delay / frame_time, division by expression 
frame_time which may be zero has undefined behavior.

--- a\src\iup_expander.c        Mon Sep 04 15:31:16 2017
+++ b\src\iup_expander.c        Tue Jan 16 23:46:10 2018
@@ -385,7 +385,12 @@
   int num_frames = iupAttribGetInt(ih, "NUMFRAMES");
   int time_delay = iupAttribGetInt(ih_timer, "ELAPSEDTIME");
   int height;
-  int current_frame = time_delay / frame_time;
+  int current_frame = 0;
+
+  if (frame_time != 0)
+  {
+     current_frame = time_delay / frame_time;
+  } 
 
   if (closing)
     height = (final_height*(num_frames - current_frame)) / num_frames;

Best.
Ranier

Attachment: iup_expander.patch
Description: iup_expander.patch

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to