PVS-StudioWarnings

PVS-Studio warning V514 for OpenCOLLADA

Nov 12th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. struct ObjectGroups{
  2.   componentList objectGrpCompList;
  3.   int objectGroupId;
  4.   short objectGrpColor;
  5.   void write(FILE* file) const;
  6. }* objectGroups;
  7.  
  8. void write(FILE* file) const
  9. {
  10.   size_t size = sizeof(objectGroups)/sizeof(ObjectGroups);
  11.   for(size_t i=0; i<size; ++i)
  12.   {
  13.     objectGroups[i].write(file);
  14.     if(i+1<size) fprintf(file," ");
  15.   }
  16. }
  17.  
  18. This suspicious code was found in OpenCOLLADA project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V514 Dividing sizeof a pointer 'sizeof (objectGroups)' by another value. There is a probability of logical error presence. mayadmdagnode.h 40
  21.  
  22. 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