I mean the function were that happen is never called if sb_ymax=sb_ymin.
Best,
Scuri
2018-01-19 11:10 GMT-02:00 Ranier VF <ranier_...@hotmail.com>:
> Hi,
> line 391: sb_range = sb_ymax - sb_ymin;
> line 393: posy = ((start_pos - sb_ymin) * range) / sb_range;
>
> and
>
> line 425: sb_range = sb_xmax - sb_xmin;
> line 427: posx = ((start_pos - sb_xmin) * range) / sb_range;
>
> If sb_ymax=sb_ymin then or sb_xmax=sb_xmin, sb_range == 0!
> How exaclty this division by zero is not executed?
>
> Best.
> Ranier.
>
> ________________________________________
> De: Antonio Scuri <antonio.sc...@gmail.com>
> Enviado: sexta-feira, 19 de janeiro de 2018 11:22
> Para: IUP discussion list.
> Assunto: Re: [Iup-users] CID 210649 (#2-4 of 4): Division or modulo by
> zero (DIVIDE_BY_ZERO)
>
> If sb_range=0 then sb_ymax=sb_ymin then the scrollbar is not shown, then
> this code is not called.
>
> Best,
> Scuri
>
>
> 2018-01-19 0:29 GMT-02:00 Ranier VF <ranier_...@hotmail.com<mailto:
> ranier_...@hotmail.com>>:
> 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
> Iup-users@lists.sourceforge.net<mailto: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
>
------------------------------------------------------------------------------
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