[Libreoffice] [REVIEW] fix for a chart crasher

Kohei Yoshida kyoshida at novell.com
Thu Mar 3 18:43:48 PST 2011

On Thu, 2011-03-03 at 09:42 -0500, Kevin Hunter wrote:

So, the reason for the negative value is in the following line

> 484: sal_Int32 nIntervalCount = static_cast<sal_Int32>( fSub / 
> m_rIncrement.Distance );

where fSub / m_rIncrement.Distance value (which is double divided by
double) is still positive *but* way above the numeric limit of
sal_Int32, which causes the casted value nIntervalCount to become
negative (probably) by way of bitwise re-interpretation.

Capping the value of fSub / m_rIncrement.Distance to
std::numeric_limits<sal_Int32>::max() keeps the value of nIntervalCount

Even with this change, though, the displayed graph showed on difference.
So, no data loss here.

Now, can someone please sign off of this, or is this change still too
risky or questionable? :-)



Kohei Yoshida, LibreOffice hacker, Calc
<kyoshida at novell.com>

More information about the LibreOffice mailing list