Hi, Divide by zero with integer, the behaviour is undefined. Good luck to catch such errors.
Best regards, Ranier Vilela ________________________________________ De: Antonio Scuri <antonio.sc...@gmail.com> Enviado: terça-feira, 28 de maio de 2019 21:09 Para: IUP discussion list. Assunto: Re: [Iup-users] CID 341015 (#1 of 1): Division or modulo by zero (DIVIDE_BY_ZERO) If that function is called with max ==0 then it is a much more serious error than a divide by zero, and we would mascarade the error by adding such code. Best, Scuri Em sáb, 25 de mai de 2019 às 08:54, Ranier VF <ranier_...@hotmail.com<mailto:ranier_...@hotmail.com>> escreveu: Hi, Fix iup_flatscrollbar.c: --- ..\..\a\src\iup_flatscrollbar.c Mon Jan 28 18:13:06 2019 +++ iup_flatscrollbar.c Sat May 25 08:53:03 2019 @@ -138,14 +138,19 @@ static void iFlatScrollBarCalcHandler(int size, int arrow_size, int max, int d, int sb_size, int pos, int* pos1, int* pos2) { int pos_p; - int range_p = size - 1 - 2 * arrow_size; - - int d_p = (d * range_p) / max; - if (d_p < sb_size) d_p = sb_size; + int d_p = 0; + const int range_p = size - 1 - 2 * arrow_size; + if (max != 0) + { + d_p = (d * range_p) / max; + } + if (d_p < sb_size) + { + d_p = sb_size; + } pos_p = (pos * (range_p - d_p)) / (max - d); pos_p += arrow_size; - *pos1 = pos_p; *pos2 = pos_p + d_p; } Best regards, Ranier Vilela_______________________________________________ Iup-users mailing list Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/iup-users _______________________________________________ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users