summaryrefslogtreecommitdiff
path: root/gcc48-pr65142.patch
diff options
context:
space:
mode:
Diffstat (limited to 'gcc48-pr65142.patch')
-rw-r--r--gcc48-pr65142.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc48-pr65142.patch b/gcc48-pr65142.patch
new file mode 100644
index 0000000..367ec16
--- /dev/null
+++ b/gcc48-pr65142.patch
@@ -0,0 +1,23 @@
+2016-06-01 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2015-10-02 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/65142
+ * src/c++11/random.cc (random_device::_M_getval()): Check read result.
+
+--- libstdc++-v3/src/c++11/random.cc (revision 228423)
++++ libstdc++-v3/src/c++11/random.cc (revision 228424)
+@@ -126,8 +126,10 @@ namespace std _GLIBCXX_VISIBILITY(defaul
+ #endif
+
+ result_type __ret;
+- std::fread(reinterpret_cast<void*>(&__ret), sizeof(result_type),
+- 1, _M_file);
++ const size_t e = std::fread(reinterpret_cast<void*>(&__ret),
++ sizeof(result_type), 1, _M_file);
++ if (e != 1)
++ std::__throw_runtime_error(__N("random_device could not be read"));
+ return __ret;
+ }
+