View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0022293 | Community | OCCT:Foundation Classes | public | 2011-02-22 12:15 | 2012-03-29 17:26 |
Reporter | Assigned To | bugmaster | |||
Priority | normal | Severity | trivial | ||
Status | closed | Resolution | fixed | ||
OS | All | ||||
Target Version | 6.5.2 | Fixed in Version | 6.5.2 | ||
Summary | 0022293: Incorrect memory allocation for NCollection_IncAllocator on Windows 64 bit | ||||
Description | Post 19966: =========== Microsoft's Visual C++ compiler uses the LLP64 model. So the pointer size is 8 bytes and long int is only 4 bytes. The type cast to (unsigned long) in line 15 of NCollection_IncAllocator.cxx #define IMEM_ALIGN(_addr) (sizeof(aligned_t)* IMEM_SIZE((unsigned long)(_addr))) therefore truncates the address (_addr) to 4 bytes (at least on Windows platforms). If a new allocated block has an address returned by malloc exceeding 4 bytes this results in a wrong pointer returned by NCollection_IncAllocator::allocateNewBlock and NCollection_IncAllocator::Allocate. This can cause an access violation in the following. I figured this out when I received some access violation crashes during meshing. As a fix I suggest casting to size_t instead: #define IMEM_ALIGN(_addr) (sizeof(aligned_t)* IMEM_SIZE((size_t)(_addr))) =========================================================================== MSDN: "In the LLP64 data model, only pointers expand to 64 bits; all other basic data types (integer and long) remain 32 bits in length". | ||||
Tags | No tags attached. | ||||
Test case number | Test case is not required | ||||
2011-04-29 16:24
|
NCollection_IncAllocator.7z (2,187 bytes) |
|
The remark seems reasonable. It was checked on win32 - problems were not found. File with fix is attached. It has to be checked on all platforms supported by OCCT. |
|
Kilril, SVN branch http://svn/svn/occt/branches/OCC22293 has been created and ready to be revised |
|
The bug branch was reviewed. Patch was applied incorrectly - that was fixed already. Also applied patch to IMEM_FREE macro which also uses wrong type (unsigned int) however this place can cause error only in future when 64bit computations come really far from now. Branch is ready for testing. |
|
Dear BugMaster, Workbench KAS:dev:mkv-OCC22293-occt has been created from SVN branch http://svn/svn/occt/branches/OCC22293 (and mkv-OCC22293-products from trank) and compiled on Linux platform. There are not regressions in mkv-OCC22293-products regarding to KAS:dev:products-20110821-opt See results in /QADisk/occttests/tests/KAS/dev/mkv-OCC22293-products_30082011/lin See reference results in /QADisk/occttests/results/KAS/dev/products-20110821-opt_22082011/lin See test cases in /QADisk/occttests/tests/ED N.B. In order to launch testing case you can make use the following instructions http://doc/doku.php?id=occt.certification |
|
Fix has been integrated to occt repository Date: 2011-08-31 19:35:11 +0400 (Wed, 31 Aug 2011) New Revision: 8929 Modified: trunk/src/NCollection/NCollection_IncAllocator.cxx |
Date Modified | Username | Field | Change |
---|---|---|---|
2011-04-06 18:31 | bugmaster | Status | closed => assigned |
2011-04-06 18:31 | bugmaster | Resolution | suspended => @0@ |
2011-04-06 19:01 | bugmaster | Assigned To | bugmaster => szy |
2011-04-28 17:58 |
|
Assigned To | szy => vsv |
2011-04-29 16:26 |
|
Status | assigned => resolved |
2011-07-29 13:21 | bugmaster | Note Added: 0017852 | |
2011-07-29 13:21 | bugmaster | Assigned To | vsv => kgv |
2011-07-29 13:21 | bugmaster | Status | resolved => assigned |
2011-07-29 13:23 | bugmaster | Status | assigned => resolved |
2011-07-29 13:23 | bugmaster | Fixed in Version | EMPTY => |
2011-07-29 13:23 | bugmaster | Description Updated | |
2011-08-02 11:23 | bugmaster | Category | OCCT:FDC => OCCT:Foundation Classes |
2011-08-23 15:06 | kgv | Note Added: 0018017 | |
2011-08-23 15:06 | kgv | Status | resolved => reviewed |
2011-08-23 15:07 | kgv | Assigned To | kgv => bugmaster |
2011-08-31 11:10 |
|
Test case number | => Test case is not required |
2011-08-31 18:54 |
|
Note Added: 0018046 | |
2011-08-31 18:54 |
|
Status | reviewed => tested |
2011-08-31 19:36 | bugmaster | Note Added: 0018047 | |
2011-08-31 19:36 | bugmaster | Status | tested => verified |
2011-08-31 19:36 | bugmaster | Assigned To | bugmaster => kgv |
2011-09-20 17:29 |
|
Target Version | => 6.5.2 |
2011-11-25 11:51 |
|
Note Edited: 0018046 | |
2012-03-29 17:26 | bugmaster | Changeset attached | => occt master c99551fa |