Advertisement
PVS-StudioWarnings

PVS-Studio warning V595 for GDCM

Nov 24th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. bool PrivateTag::ReadFromCommaSeparatedString(const char *str)
  2. {
  3.   unsigned int group = 0, element = 0;
  4.   std::string owner;
  5.   owner.resize( strlen(str) );
  6.   if( !str || sscanf(str, "%04x,%04x,%s", &group ,
  7.                      &element, &owner[0] ) != 3 )
  8.   {
  9.     gdcmDebugMacro( "Problem reading Private Tag: " << str );
  10.     return false;
  11.   }
  12.   ....
  13. }
  14.  
  15. This suspicious code was found in GDCM project by PVS-Studio static code analyzer.
  16. Warning message is:
  17. V595 The 'str' pointer was utilized before it was verified against nullptr. Check lines: 26, 27. gdcmprivatetag.cxx 26
  18.  
  19. 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
Advertisement