Bug #6170
Heap corruption in PAL
| Status: | Closed | Start Date: | 08/08/2012 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | % Done: | 0% |
||
| Category: | - | |||
| Target version: | - | |||
| Platform: | Patch supplied: | No | ||
| Platform version: | Affected version: | master | ||
| Status info: | Causes crash or corruption: | No | ||
| Resolution: |
Description
My debugger (VS2008) was complaining about a heap corruption. After some investigation I could locate the following:
costcalculator.h:
double dist8;
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.
Associated revisions
History
Updated by Jürgen Fischer 10 months ago
- Status changed from New to Closed
Fixed in changeset 928da6e3bb435da0112bb373096871597012e212.