Hello all,
i am developing a certain software with OCC 6.2/MSVC 8 (Visual Studio 2005) and i am using OCC capability of importing IGES files. I have stumbled over an IGS file which consistently breaks OCC somewhere inside with heap corruption, that is something like:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
HEAP[IGESReadTest.exe]: Heap block at 04FFC140 modified at 04FFC210 past requested size of c8
Windows has triggered a breakpoint in IGESReadTest.exe.
This may be due to a corruption of the heap, and indicates a bug in IGESReadTest.exe or any of the DLLs it has loaded.
The output window may have more diagnostic information
Before diving into OCC source for hours, i am trying to ask in this forum. Maybe even the OCC developers may have an eye on it.
Due to lack of possibility to attach files in forum, i had to host the file on
http://www.studioface.cz/tempstore/occ/heapcorrupt.igs
There is also the same file which i loaded into Rhinoceros (without problem) and then re-exported as IGES. That file is loaded by OCC without problem.
http://www.studioface.cz/tempstore/occ/corrected.igs
Changing the compilation model (debug/release) or memory model (MD/MT) does not help.
The program itself is nothing fancy, but for completeness of the case, i am posting a minimal Win32 program which exposes the problem. The return statements and overall meaning of the code is not crucial.
Thanks in advance for any feedback,
Pavel Zdenek
int _tmain(int argc, _TCHAR* argv[])
{
IGESControl_Reader Reader;
Standard_Integer status = 0;
try {
status = Reader.ReadFile("heapcorrupt.igs"); //
} catch( Standard_Failure ) {
return IFSelect_RetFail;
}
if (status == IFSelect_RetDone)
{
Reader.TransferRoots();
TopoDS_Shape shape = Reader.OneShape();
}
return status;
}