Examples of errors detected by the V663 diagnostic


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.


POCO C++ Libraries

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. Util inifileconfiguration.cpp 86


void IniFileConfiguration::load(std::istream& istr)
{
  _map.clear();
  _sectionKey.clear();
  while (!istr.eof())
  {
    parseLine(istr);
  }
}

Similar errors can be found in some other places:

  • 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. Util propertyfileconfiguration.cpp 79

OpenMW

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. components translation.cpp 45


void Storage::loadDataFromStream(
  ContainerType& container, std::istream& stream)
{
  std::string line;
  while (!stream.eof())
  {
    std::getline( stream, line );
    ....
  }
  ....
}

Grassroots DICOM library (GDCM)

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


template <typename TDE, typename TSwap>
std::istream &DataSet::Read(std::istream &is) {
  DataElement de;
  while( !is.eof() && de.Read<TDE,TSwap>(is) )
  {
    //std::cerr << "DEBUG:" << de << std::endl;
    InsertDataElement( de );
  }
  return is;
}

Similar errors can be found in some other places:

  • 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 70
  • 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 84
  • 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 105
  • And 3 additional diagnostic messages.

ITK

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. metautils.cxx 998


static bool MET_SkipToVal(METAIO_STREAM::istream &fp)
{
  ....
  while(  !fp.eof() && c != MET_SeperatorChar && c != ':' )
    {
    c = fp.get();
    }
  ....
}

Similar errors can be found in some other places:

  • 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. metautils.cxx 1003
  • 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. metautils.cxx 1060
  • 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. metautils.cxx 1066
  • And 1 additional diagnostic messages.

SETI@home

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. sqlblob.h 58


template <typename T>
std::istream &operator >>(std::istream &i, sqlblob<T> &b)
{
  ....
  while (!i.eof())
  {
    i >> tmp;
    buf+=(tmp+' ');
  }
  ....
}

GNU Octave

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. ls-mat-ascii.cc 75


static std::string get_mat_data_input_line(std::istream& is)
{
  ....
  do
  {
    while (is.get(c))
    {
      ....
    }
  }
  while (!(have_data || is.eof()));
  ....
}

NCBI Genome Workbench

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. ncbicgi.cpp 1564


typedef std::istream CNcbiIstream;
void CCgiRequest::Serialize(CNcbiOstream& os) const
{
  ....
  CNcbiIstream* istrm = GetInputStream();
  if (istrm) {
    char buf[1024];
    while(!istrm->eof()) {
      istrm->read(buf, sizeof(buf));
      os.write(buf, istrm->gcount());
    }
  }
}


Bugs Found

Checked Projects
336
Collected Errors
12 743