|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77279 - trunk/boost/graph/detail
From: jewillco_at_[hidden]
Date: 2012-03-08 21:19:02
Author: jewillco
Date: 2012-03-08 21:19:01 EST (Thu, 08 Mar 2012)
New Revision: 77279
URL: http://svn.boost.org/trac/boost/changeset/77279
Log:
Added range checking in asserts
Text files modified:
trunk/boost/graph/detail/histogram_sort.hpp | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
Modified: trunk/boost/graph/detail/histogram_sort.hpp
==============================================================================
--- trunk/boost/graph/detail/histogram_sort.hpp (original)
+++ trunk/boost/graph/detail/histogram_sort.hpp 2012-03-08 21:19:01 EST (Thu, 08 Mar 2012)
@@ -60,6 +60,7 @@
// Put the degree of each vertex v into m_rowstart[v + 1]
for (KeyIterator i = begin; i != end; ++i) {
if (key_filter(*i)) {
+ assert (key_transform(*i) < numkeys);
++starts[key_transform(*i) + 1];
}
}
@@ -99,6 +100,7 @@
for (KeyIterator i = key_begin; i != key_end; ++i, ++v1i) {
if (key_filter(*i)) {
vertices_size_type source = key_transform(*i);
+ assert (source < numkeys);
EdgeIndex insert_pos = current_insert_positions[source];
++current_insert_positions[source];
values1_out[insert_pos] = *v1i;
@@ -137,6 +139,7 @@
for (KeyIterator i = key_begin; i != key_end; ++i, ++v1i, ++v2i) {
if (key_filter(*i)) {
vertices_size_type source = key_transform(*i);
+ assert (source < numkeys);
EdgeIndex insert_pos = current_insert_positions[source];
++current_insert_positions[source];
values1_out[insert_pos] = *v1i;
@@ -163,6 +166,7 @@
std::vector<EdgeIndex> insert_positions(rowstart, rowstart + numkeys);
// 2. Swap the sources and targets into place
for (size_t i = 0; i < rowstart[numkeys]; ++i) {
+ assert (key_transform(key_begin[i]) < numkeys);
// While edge i is not in the right bucket:
while (!(i >= rowstart[key_transform(key_begin[i])] && i < insert_positions[key_transform(key_begin[i])])) {
// Add a slot in the right bucket
@@ -197,6 +201,7 @@
std::vector<EdgeIndex> insert_positions(rowstart, rowstart + numkeys);
// 2. Swap the sources and targets into place
for (size_t i = 0; i < rowstart[numkeys]; ++i) {
+ assert (key_transform(key_begin[i]) < numkeys);
// While edge i is not in the right bucket:
while (!(i >= rowstart[key_transform(key_begin[i])] && i < insert_positions[key_transform(key_begin[i])])) {
// Add a slot in the right bucket
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk