]> git.pld-linux.org Git - packages/STLport.git/commitdiff
- bug (infinite loop) fix.
authorPaweł Sikora <pluto@pld-linux.org>
Mon, 30 Jun 2008 10:03:24 +0000 (10:03 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    STLport-fstream.patch -> 1.1

STLport-fstream.patch [new file with mode: 0644]

diff --git a/STLport-fstream.patch b/STLport-fstream.patch
new file mode 100644 (file)
index 0000000..577cbf9
--- /dev/null
@@ -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. 
This page took 0.079566 seconds and 4 git commands to generate.