SOURCES: STLport-fstream.patch (NEW) - bug (infinite loop) fix.

pluto pluto at pld-linux.org
Mon Jun 30 12:03:29 CEST 2008


Author: pluto                        Date: Mon Jun 30 10:03:29 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- bug (infinite loop) fix.

---- Files affected:
SOURCES:
   STLport-fstream.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/STLport-fstream.patch
diff -u /dev/null SOURCES/STLport-fstream.patch:1.1
--- /dev/null	Mon Jun 30 12:03:30 2008
+++ SOURCES/STLport-fstream.patch	Mon Jun 30 12:03:24 2008
@@ -0,0 +1,31 @@
+this patch fixes inifinite loop in following testcase:
+
+#include <fstream>
+#include <string>
+#include <cassert>
+int main()
+{
+        std::ifstream in( "/tmp" );
+        assert( in.good() );
+        std::string buf;
+        std::getline( in, buf );
+        assert( in.fail() );
+}
+
+Index: STLport-trunk/stlport/stl/_fstream.c
+===================================================================
+--- STLport-trunk/stlport/stl/_fstream.c	(wersja 3579)
++++ STLport-trunk/stlport/stl/_fstream.c	(wersja 3580)
+@@ -513,6 +513,12 @@
+   // to make progress.
+   for (;;) {
+     ptrdiff_t __n = _M_base._M_read(_M_ext_buf_end, _M_ext_buf_EOS - _M_ext_buf_end);
++    if (__n < 0) {
++      // Read failed, maybe we should set err bit on associated stream...
++      this->setg(0, 0, 0);
++      return traits_type::eof();
++    }
++
+     _M_ext_buf_end += __n;
+ 
+     // If external buffer is empty there is nothing to do. 
================================================================


More information about the pld-cvs-commit mailing list