Hi,
Issue found by Coverity Scan.
CID 210649 (#2-4 of 4): Division or modulo by zero (DIVIDE_BY_ZERO)
divide_by_zero: In expression (start_pos - sb_ymin) * range / sb_range,
division by expression sb_range which may be zero has undefined behavior.
--- a\srcglcontrols\iup_glscrollbars.c Wed Apr 05 16:52:32 2017
+++ b\srcglcontrols\iup_glscrollbars.c Fri Jan 19 00:28:01 2018
@@ -390,7 +390,12 @@
range = ymax - ymin - 2 * sb_size;
sb_range = sb_ymax - sb_ymin;
- posy = ((start_pos - sb_ymin) * range) / sb_range;
+ if (sb_range != 0)
+ {
+ posy = ((start_pos - sb_ymin) * range) / sb_range;
+ } else {
+ posy = 0;
+ }
posy += ymin + sb_size;
posy += diff_y;
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users