[ace-users] Division by zero in ACE_Stats::quotient() method
Vural, Okan
okan.vural at siemens.com
Thu Oct 1 02:15:15 CDT 2015
Hello Johnny,
I didn't know you switched to GIT. Thank you for the Info.
Anyway, Problem is obvious and methods seem unchanged (Lines 276 and 307) : https://github.com/DOCGroup/ATCD/blob/master/ACE/ace/Stats.cpp
We don’t use & call Stats methods. We don’t have unit tests either. Problem was detected by our Static Code Analysis Tool. It can clearly be seen in the methods. So, I wanted to inform the community about this.
Best Regards
Okan
-----Ursprüngliche Nachricht-----
Von: Johnny Willemsen [mailto:jwillemsen at remedy.nl]
Gesendet: Donnerstag, 1. Oktober 2015 09:05
An: Vural, Okan; ace-users at list.isis.vanderbilt.edu
Betreff: Re: [ace-users] Division by zero in ACE_Stats::quotient() method
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