PVS-StudioWarnings

PVS-Studio warning V598 for Coin3D

Nov 12th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. class COIN_DLL_API SoDetail {
  2.   ....
  3.   virtual ~SoDetail();
  4.   virtual SoDetail * copy(void) const = 0;
  5.   ....
  6. }
  7.  
  8. class SoPointDetail : public SoDetail {
  9. };
  10.  
  11. void
  12. soshape_primdata::shapeVertex(const SoPrimitiveVertex * const v)
  13. {
  14.   ....
  15.   SoPointDetail* newparray = new SoPointDetail[this->arraySize];
  16.   memcpy(newparray, this->pointDetails,
  17.     sizeof(SoPointDetail)* this->counter);
  18.   ....
  19. }
  20.  
  21. This suspicious code was found in Coin3D project by PVS-Studio static code analyzer.
  22. Warning message is:
  23. V598 The 'memcpy' function is used to copy the fields of 'SoPointDetail' class. Virtual method table will be damaged by this. soshape_primdata.cpp 202
  24.  
  25. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment