]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Check that a stream is good while we read. 4418/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Fri, 26 May 2017 16:03:29 +0000 (10:03 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 26 May 2017 16:03:29 +0000 (10:03 -0600)
This addresses another (correct) Coverity warning.

source/base/index_set.cc

index 81e98c95e6f508f3200a5bae3bd797193e8020ea..4ed7b59b3a420e62a19dc8a1f5471df906610669 100644 (file)
@@ -459,14 +459,18 @@ IndexSet::write(std::ostream &out) const
 void
 IndexSet::read(std::istream &in)
 {
+  AssertThrow (in, ExcIO());
+
   size_type s;
-  unsigned int numranges;
+  unsigned int n_ranges;
 
-  in >> s >> numranges;
+  in >> s >> n_ranges;
   ranges.clear();
   set_size(s);
-  for (unsigned int i=0; i<numranges; ++i)
+  for (unsigned int i=0; i<n_ranges; ++i)
     {
+      AssertThrow (in, ExcIO());
+
       size_type b, e;
       in >> b >> e;
       add_range(b,e);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.