[ace-users] Division by zero in ACE_Stats::quotient() method
Johnny Willemsen
jwillemsen at remedy.nl
Thu Oct 1 02:05:13 CDT 2015
Hi,
Please always use the PRF form, that always helps. The ACE code is not
maintained anymore through svn, it is all on github, see
https://github.com/DOCGroup/ATCD/.
Could you extend one of our unit tests under ACE_wrappers/tests (or add
a new one) and create a pull request which resolves this issue. Maybe
for this kind of problems it can also help to check the Coverity results
for ATCD, see https://scan.coverity.com/projects/1
Best regards,
Johnny Willemsen
Remedy IT
On 10/01/2015 09:00 AM, Vural, Okan wrote:
> Hello All,
>
> In the both “ACE_Stats::quotient” methods there seems a potential
> division by zero problem (See below). It is independent of platform,
> this is why I didn’t send the problem in a Problem Report. And I checked
> the latest version in ACE SVN as well. It seems still same in the latest
> version.
>
> *ACE Version **:* V 630
> *File :* Stats.cpp
> *Method **:*
>
> *void*
> *ACE_Stats::quotient* (*const* ACE_UINT64 dividend,
> *const* ACE_UINT32 divisor,
> ACE_Stats_Value "ient)
> {
> // The whole part of the division comes from simple integer division.
> quotient.whole (*static_cast*<ACE_UINT32> (divisor == 0
> ? 0 : dividend / divisor));
>
> *if* (quotient.precision () > 0 *|| divisor == 0*)
> {
> *const* ACE_UINT32 field = quotient.fractional_field ();
> …
> quotient.fractional (*static_cast*<ACE_UINT32> (
> dividend % divisor * field / *divisor*));
>
> With best regards,
> Okan Vural
>
>
>
> _______________________________________________
> ace-users mailing list
> ace-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/cgi-bin/mailman/listinfo/ace-users
>
More information about the ace-users
mailing list