View Issue Details

IDProjectCategoryView StatusLast Update
0023284CommunityOCCT:Foundation Classespublic2013-04-29 15:23
ReporterPawel Assigned Toomy 
PrioritynormalSeveritycrash 
Status closedResolutionfixed 
PlatformWindowsOSVC++ 2008 
Product Version6.5.3 
Target Version6.6.0Fixed in Version6.6.0 
Summary0023284: Using 'memcpy' on class that contains a virtual method
DescriptionThe 'memcpy' function is used to copy the fields of 'MemBlock' class. Virtual method table will be damaged by this.

Warning issued by PVS-Studio in NCollection_Vector.cxx, line 296:

memcpy (aData, aSource, aSize * sizeof(MemBlock));

This might lead to a crash but I haven't tested it.
TagsNo tags attached.
Test case numberNot needed

Relationships

related to 0023267 closedomy cppcheck warning: Using 'memcpy' on class that contains a virtual method 

Activities

omy

2013-02-01 14:41

developer   ~0023234

Dear kgv,
I've implemented a fix into branch CR23284.
Please, review.

kgv

2013-02-04 11:57

developer   ~0023248

Patch was reviewed without remarks.
Ready for testing in CR23284_1 branch.

mkv

2013-02-05 12:50

tester   ~0023260

Dear BugMaster,

Branch CR23284_1 was rebased on the current master.

Branch CR23284_1 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
SHA-1: 3ad74093025719d0110ba6ea20838240cdccd35d

There are following compilation errors:
http://jenkins-test-01.nnov.opencascade.com/user/mnt/my-views/view/CR23284_1/job/mnt-CR23284_1-master_build_occt_products_linux/1/parsed_console/?
../../../inc/QMData_BgrNode.hxx:120: error:
'QMData_BgrNode::QMData_BgrNode(const QMData_BgrNode&)' is protected

dn60/WOKLOC/wok_entities/LOC/dev/CR23284-1-master-occt/inc/NCollection_Vector.hxx:92:
 error: within this context

Number of compiler warnings:

occt component :
Linux: 3 (3 on master)
Windows: 39 (39 on master)

Regressions:
http://occt-tests/CR23284-1-master-occt/Mandriva2010/summary.html
bugs step(007) bug55 bug272_5 bug16351

Improvements:
No improvements

Testing cases:
Not needed

omy

2013-02-13 14:49

developer   ~0023319

Dear SZV,
I've implemented a fix into branch CR23284_2.
Please, review.

kgv

2013-02-13 22:28

developer   ~0023330

Dear omy,

could you please consider conversion of NCollection_BaseVector::MemBlock class to POD structure (remove myAlloc field, destructor and custom constructors)? I don't see any usage of NCollection_Vector::~MemBlock in code at all since elements destroyed by NCollection_Vector::Reinit and allocated only within NCollection_Vector::FuncDataInit.

Also this is preferred to rebase your patch before sending it to review since NCollection_Vector sources are out-dated in your branch.

omy

2013-02-14 17:19

developer   ~0023341

Dear kgv,
I've implemented a fix into branch CR23284_2 and rebased it onto current master.
Please, review.

kgv

2013-03-07 17:37

developer   ~0023630

Patch is ready for testing in CR23284_3 branch.

mkv

2013-03-12 12:23

tester   ~0023663

Dear BugMaster,

Branch CR23284_3 (and products from GIT master) was compiled on Linux and Windows platforms.

There are following compilation errors:
http://jenkins-test-01.nnov.opencascade.com:8080/user/mnt/my-views/view/CR23284_3/job/mnt-CR23284_3-master_build_occt_linux/1/consoleFull
/bin/sh ../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../.. -I../../../inc -I../../../drv/math -I../../../src/math -I../../../drv/ElCLib -I../../../src/ElCLib -I../../../drv/ElSLib -I../../../src/ElSLib -I../../../drv/BSplCLib -I../../../src/BSplCLib -I../../../drv/BSplSLib -I../../../src/BSplSLib -I../../../drv/PLib -I../../../src/PLib -I../../../drv/Precision -I../../../src/Precision -I../../../drv/GeomAbs -I../../../src/GeomAbs -I../../../drv/Poly -I../../../src/Poly -I../../../drv/CSLib -I../../../src/CSLib -I../../../drv/Convert -I../../../src/Convert -I../../../drv/Bnd -I../../../src/Bnd -I../../../drv/gp -I../../../src/gp -I../../../drv/TColgp -I../../../src/TColgp -I../../../drv/TopLoc -I../../../src/TopLoc -I/dn48/PRODUCTS/salome/6.x/opt/MANDRIVA.2010/6.6.0/jdk1.6.0/include -I/dn48/PRODUCTS/salome/6.x/opt/MANDRIVA.2010/6.6.0/jdk1.6.0/include/linux -DNDEBUG -DNo_Exception -DCSFDB -DOCC_CONVERT_SIGNALS -DLIN -DLININTEL -D_GNU_SOURCE=1 -O2 -MT Poly_MakeLoops.lo -MD -MP -MF .deps/Poly_MakeLoops.Tpo -c -o Poly_MakeLoops.lo `test -f '../../../src/Poly/Poly_MakeLoops.cxx' || echo './'`../../../src/Poly/Poly_MakeLoops.cxx
In file included from ../../../inc/Poly_CoherentTriangulation.hxx:29,
                 from ../../../src/Poly/Poly_CoherentTriangulation.cxx:21:
../../../inc/NCollection_Vector.hxx: In constructor 'NCollection_Vector<TheItemType>::NCollection_Vector(Standard_Integer, const Handle_NCollection_BaseAllocator&)':
../../../inc/NCollection_Vector.hxx:117: error: 'myAllocator' was not declared in this scope
../../../inc/NCollection_Vector.hxx: In copy constructor 'NCollection_Vector<TheItemType>::NCollection_Vector(const NCollection_Vector<TheItemType>&)':
../../../inc/NCollection_Vector.hxx:122: error: 'myAllocator' was not declared in this scope
../../../inc/NCollection_Vector.hxx: In destructor 'NCollection_Vector<TheItemType>::~NCollection_Vector()':
../../../inc/NCollection_Vector.hxx:134: error: 'myAllocator' was not declared in this scope
../../../inc/NCollection_Vector.hxx: In member function 'TheItemType& NCollection_Vector<TheItemType>::Append(const TheItemType&)':
../../../inc/NCollection_Vector.hxx:203: error: 'myAllocator' was not declared in this scope
../../../inc/NCollection_Vector.hxx: In member function 'TheItemType& NCollection_Vector<TheItemType>::SetValue(Standard_Integer, const TheItemType&)':
../../../inc/NCollection_Vector.hxx:259: error: 'myAllocator' was not declared in this scope
../../../inc/NCollection_Vector.hxx: In member function 'void NCollection_Vector<TheItemType>::Assign(const NCollection_Vector<TheItemType>&, Standard_Boolean)':
../../../inc/NCollection_Vector.hxx:343: error: 'myAllocator' was not declared in this scope

omy

2013-03-13 09:54

developer   ~0023690

Dear kgv,
I've fixed the mentioned compilation errors.
Please, review.

kgv

2013-03-13 09:59

developer   ~0023691

No remarks, please test.

mkv

2013-03-15 14:15

tester   ~0023748

Last edited: 2013-03-15 14:18

Dear BugMaster,

Branch CR23284_3 (and products from GIT master) was compiled on Linux and Windows platforms and tested without rebase.
SHA-1: 9f7ef1d5cabd8756912221bb68444ac7fb473e69

Number of compiler warnings:

occt component :
Linux: 3 (3 on master)
Windows: 11 (11 on master)

products component :
Linux: 0 (0 on master)
Windows: 50 (50 on master)

Regressions:
No regressions

Improvements:
No improvements

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 242475480 / 243421460
Total CPU difference: 17395.4600000001 / 15475.660000000038

Testing on Windows:
Total MEMORY difference: 345678912 / 346233352
Total CPU difference: 17723.0625 / 21620.5

There are not serious differences in images found by testdiff.

Related Changesets

occt: master f4aad56f

2013-03-15 09:04:26

omy

Details Diff
0023284: Using 'memcpy' on class that contains a virtual method

NCollection_BaseVector::MemBlock class was converted to POD structure
Added fix for compilation of multiple inherited classes on gcc/Linux
Affected Issues
0023284
mod - src/NCollection/NCollection_BaseVector.cxx Diff File
mod - src/NCollection/NCollection_BaseVector.hxx Diff File
mod - src/NCollection/NCollection_Vector.hxx Diff File

Issue History

Date Modified Username Field Change
2012-07-16 13:24 Pawel New Issue
2012-07-16 13:24 Pawel Assigned To => bugmaster
2012-07-16 13:25 Pawel Relationship added related to 0023267
2012-10-11 13:27 oan Assigned To bugmaster => isn
2012-10-11 13:28 oan Status new => assigned
2012-10-23 18:16 abv Target Version 6.5.4 => 6.6.0
2012-10-26 17:53 abv Assigned To isn => omy
2013-02-01 14:41 omy Note Added: 0023234
2013-02-01 14:41 omy Assigned To omy => kgv
2013-02-01 14:41 omy Status assigned => resolved
2013-02-04 11:57 kgv Note Added: 0023248
2013-02-04 11:57 kgv Assigned To kgv => bugmaster
2013-02-04 11:57 kgv Status resolved => reviewed
2013-02-05 12:50 mkv Note Added: 0023260
2013-02-05 12:50 mkv Test case number => Not needed
2013-02-05 12:50 mkv Assigned To bugmaster => omy
2013-02-05 12:50 mkv Status reviewed => assigned
2013-02-13 14:49 omy Note Added: 0023319
2013-02-13 14:49 omy Assigned To omy => szv
2013-02-13 14:49 omy Status assigned => resolved
2013-02-13 22:28 kgv Note Added: 0023330
2013-02-13 22:28 kgv Assigned To szv => omy
2013-02-13 22:28 kgv Status resolved => assigned
2013-02-14 17:19 omy Note Added: 0023341
2013-02-14 17:19 omy Assigned To omy => kgv
2013-02-14 17:19 omy Status assigned => resolved
2013-03-07 17:37 kgv Note Added: 0023630
2013-03-07 17:37 kgv Assigned To kgv => bugmaster
2013-03-07 17:37 kgv Status resolved => reviewed
2013-03-07 17:45 mkv Assigned To bugmaster => mkv
2013-03-12 12:23 mkv Note Added: 0023663
2013-03-12 12:23 mkv Assigned To mkv => omy
2013-03-12 12:23 mkv Status reviewed => assigned
2013-03-13 09:54 omy Note Added: 0023690
2013-03-13 09:54 omy Assigned To omy => kgv
2013-03-13 09:54 omy Status assigned => resolved
2013-03-13 09:59 kgv Note Added: 0023691
2013-03-13 09:59 kgv Assigned To kgv => bugmaster
2013-03-13 09:59 kgv Status resolved => reviewed
2013-03-13 13:31 mkv Assigned To bugmaster => mkv
2013-03-15 14:15 mkv Note Added: 0023748
2013-03-15 14:18 mkv Note Edited: 0023748
2013-03-15 14:18 mkv Assigned To mkv => bugmaster
2013-03-15 14:18 mkv Status reviewed => tested
2013-03-18 20:48 omy Changeset attached => occt master f4aad56f
2013-03-18 20:48 omy Assigned To bugmaster => omy
2013-03-18 20:48 omy Status tested => verified
2013-03-18 20:48 omy Resolution open => fixed
2013-04-23 13:35 aiv Status verified => closed
2013-04-29 15:23 aiv Fixed in Version => 6.6.0