Heap corruption in PAL
|Assigned to:||Matthias Kuhn||% Done:||
|Platform version:||Affected version:||master|
|Status info:||Causes crash or corruption:||No|
My debugger (VS2008) was complaining about a heap corruption. After some investigation I could locate the following:
costcalculator.cpp, line 275 (in void PolygonCostCalculator::updatePoint( PointSet *pset )):
int i = ( int )( beta / a45 );
dist[i] = d;
Guess what happens if i == 8
Probably nothing unless you happen to have something important after the dist array.
Now you might wonder, how comes, that i is 8. I've no idea why, but I guess that following pure math it shouldn't.
Back to line 275
i = beta / a45
In my case beta = 6.2831853071795862 and a45 = 0.78539816339744828
My windows calc shows me as the result 7.9999999999999999490704182105935 which should be rounded to 7. But my debugger shows me 8.
I don't whose fault it is that windows calculator gives another result than dividing two doubles does, but there seems to be something wrong.