PVS-StudioWarnings

PVS-Studio warning V514 for OpenMS

Nov 26th, 2014
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. CompressedInputSource::CompressedInputSource(
  2.   const String & file_path, const char * header,
  3.   MemoryManager * const manager)
  4.   : xercesc::InputSource(manager)
  5. {
  6.   if (sizeof(header) / sizeof(char) > 1)
  7.   {
  8.     head_[0] = header[0];
  9.     head_[1] = header[1];
  10.   }
  11.   else
  12.   {
  13.     head_[0] = '\0';
  14.     head_[1] = '\0';
  15.   }
  16.   ....
  17. }
  18.  
  19. This suspicious code was found in OpenMS project by PVS-Studio static code analyzer.
  20. Warning message is:
  21. V514 Dividing sizeof a pointer 'sizeof (header)' by another value. There is a probability of logical error presence. compressedinputsource.c 52
  22.  
  23. 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