PVS-StudioWarnings

PVS-Studio warning V663 for GDCM

Nov 18th, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. template <typename TDE, typename TSwap>
  2. std::istream &DataSet::Read(std::istream &is) {
  3.   DataElement de;
  4.   while( !is.eof() && de.Read<TDE,TSwap>(is) )
  5.   {
  6.     //std::cerr << "DEBUG:" << de << std::endl;
  7.     InsertDataElement( de );
  8.   }
  9.   return is;
  10. }
  11.  
  12. This suspicious code was found in GDCM project by PVS-Studio static code analyzer.
  13. Warning message is:
  14. V663 Infinite loop is possible. The 'cin.eof()' condition is insufficient to break from the loop. Consider adding the 'cin.fail()' function call to the conditional expression. gdcmdataset.txx 59
  15.  
  16. 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