PVS-StudioWarnings

PVS-Studio warning V598 for SlimDX

Nov 20th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. template<typename IBaseInterface>
  2. struct TVariable : public IBaseInterface
  3. {
  4.   virtual BOOL IsValid() { .... }
  5.   ....
  6. };
  7.  
  8. struct SMember :
  9.   public TVariable<TMember<ID3DX11EffectVariable> >
  10. {
  11. };
  12.  
  13. CEffectVectorOwner<SMember> m_pMemberInterfaces;
  14.  
  15. HRESULT CEffect::CopyMemberInterfaces( CEffect* pEffectSource )
  16. {
  17.   ....
  18.   ZeroMemory( &m_pMemberInterfaces[i],
  19.               sizeof(SMember) * ( Members - i ) );
  20.   ....
  21. }
  22.  
  23. This suspicious code was found in SlimDX project by PVS-Studio static code analyzer.
  24. Warning message is:
  25. V598 The 'memset' function is used to nullify the fields of 'SMember' class. Virtual method table will be damaged by this. effectnonruntime.cpp 1739
  26.  
  27. 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