aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrançois Dumont <fdumont@gcc.gnu.org>2017-10-16 05:44:03 +0000
committerFrançois Dumont <fdumont@gcc.gnu.org>2017-10-16 05:44:03 +0000
commit1be043a140d516e16930bbc357f5ccb7b98c1db5 (patch)
tree05ae0cb7d68332c997f4cb7dce9d8c464c897856
parent181640f627f5db588324317df2eef17f034952ac (diff)
downloadgcc-1be043a140d516e16930bbc357f5ccb7b98c1db5.zip
gcc-1be043a140d516e16930bbc357f5ccb7b98c1db5.tar.gz
gcc-1be043a140d516e16930bbc357f5ccb7b98c1db5.tar.bz2
re PR libstdc++/82558 (V8 JavaScript engine segfaults since r249235)
2017-10-16 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/82558 * include/bits/stl_bvector.h (fill): Add iterator offset check. * testsuite/23_containers/vector/bool/82558.cc: New. From-SVN: r253776
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/include/bits/stl_bvector.h2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/82558.cc32
3 files changed, 39 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 6419688..9177f04 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2017-10-16 François Dumont <fdumont@gcc.gnu.org>
+
+ PR libstdc++/82558
+ * include/bits/stl_bvector.h (fill): Add iterator offset check.
+ * testsuite/23_containers/vector/bool/82558.cc: New.
+
2017-10-13 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/82522
diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h
index d24e760..ac54884 100644
--- a/libstdc++-v3/include/bits/stl_bvector.h
+++ b/libstdc++-v3/include/bits/stl_bvector.h
@@ -417,7 +417,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
if (__last._M_offset != 0)
__fill_bvector(__last._M_p, 0, __last._M_offset, __x);
}
- else
+ else if (__first._M_offset != __last._M_offset)
__fill_bvector(__first._M_p, __first._M_offset, __last._M_offset, __x);
}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/82558.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/82558.cc
new file mode 100644
index 0000000..6362688
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/82558.cc
@@ -0,0 +1,32 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.3.8 class vector<bool>
+
+#include <vector>
+
+// libstdc++/82558
+void test01()
+{
+ std::vector<bool> v;
+ std::fill(v.begin(), v.begin(), false);
+}
+
+int main()
+{
+ test01();
+}