[bigint] Potential Divide By Zero in Big Integer Library

Matt McCutchen <matt at mattmccutchen.net>
Sun Mar 27 20:35:31 PDT 2011


On Wed, 2011-02-23 at 13:56 -0600, Rothwell, Chris wrote: 
> We are evaluating CodeSonar from Grammatech, a static code analysis
> tool. It found a potential divide by zero in your library. This may
> not be a real issue, but I’m passing this on for you to evaluate. The
> attached file shows CodeSonar’s analysis.

[The analysis showed the "bitLen" call at BigUnsignedInABase.cc:40
returning 1, leading to a "ceilingDiv" by zero.]

This is a false positive.  Since the base is checked to be at least 2,
bitLen will return 2 or greater.

-- 
Matt




More information about the bigint mailing list