Re: [Iup-users] CID 210583 (#1 of 1): Division or modulo by zero (DIVIDE_BY_ZERO)

2018-01-17 Thread Antonio Scuri
  Fixed and committed to SVN.

Best,
Scuri


2018-01-16 23:46 GMT-02:00 Ranier VF :

> 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.cMon Sep 04 15:31:16 2017
> +++ b\src\iup_expander.cTue 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
> 
> --
> 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
>
>
--
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


[Iup-users] CID 210583 (#1 of 1): Division or modulo by zero (DIVIDE_BY_ZERO)

2018-01-16 Thread Ranier VF
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.cMon Sep 04 15:31:16 2017
+++ b\src\iup_expander.cTue 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

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