This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] fix range check in bitset::test()
- To: gcc-patches at gcc dot gnu dot org
- Subject: [v3] fix range check in bitset::test()
- From: Phil Edwards <pedwards at disaster dot jaj dot com>
- Date: Mon, 4 Jun 2001 12:30:10 -0400
Fixes libstdc++/3018... which I'll have to go back and add to the changelog
on the next pass, whoops. Anyhow, since positions are zero-based, a
position can't be the same as the size of the "array". Tested, approved,
applied with a new test case; branch and trunk.
2001-06-04 Brendan Kehoe <brendan@zen.org>
Phil Edwards <pme@sources.redhat.com>
* include/bits/std_bitset.h (bitset::test): Fix __pos >= _Nb
comparison; all positions must be < _Nb.
* testsuite/23_containers/bitset_members.cc: New file.
Index: include/bits/std_bitset.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/std_bitset.h,v
retrieving revision 1.6
diff -u -3 -p -r1.6 std_bitset.h
--- std_bitset.h 2001/03/24 23:46:38 1.6
+++ std_bitset.h 2001/06/04 17:40:01
@@ -629,7 +629,7 @@ public:
}
bool test(size_t __pos) const {
- if (__pos > _Nb)
+ if (__pos >= _Nb)
__STL_THROW(out_of_range("bitset"));
return _Unchecked_test(__pos);
cvs server: testsuite/23_containers/bitset_members.cc is a new entry, no comparison available