Opened 18 years ago
Closed 18 years ago
#261 closed Bugs (Fixed)
Dereferencing invalid iterator
| Reported by: | nobody | Owned by: | jsiek | 
|---|---|---|---|
| Milestone: | Component: | graph | |
| Version: | None | Severity: | |
| Keywords: | Cc: | 
Description
boost 1.31.0, subgraph.hpp, line 179, function find_vertex(vertex_descriptor u_global) const; return std::make_pair((*i).second, i != m_local_vertex.end()); //if i == m_local_vertex.end() - iterator should not be dereferenced
Change History (3)
comment:2 by , 18 years ago
Logged In: YES 
user_id=1033441
Well, actually you can only make it crash consistently building 
with STLPort with _STLP_DEBUG macro defined - only then 
dereferencing invalid iterator is checked. In all other cases it 
may crush - or it may not (coz dereferencing an invalid 
iterator causes an undefined behavior)
#define _STLP_DEBUG
#include <boost/config.hpp>
#include <iostream>
#include <boost/graph/subgraph.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_utility.hpp>
int main(int,char*[])
{
  using namespace boost;
  typedef adjacency_list_traits<vecS, vecS, directedS> Traits;
  typedef subgraph< adjacency_list<vecS, vecS, directedS,
    property<vertex_color_t, int>, property<edge_index_t, 
int> > > Graph;
  const int N = 6;
  Graph G0(N);
  enum { A, B, C, D, E, F};
  Graph& G1 = G0.create_subgraph();
  add_vertex(C, G1);    
  G1.find_vertex(78);
  return 0;
}
comment:3 by , 18 years ago
| Status: | assigned → closed | 
|---|
Logged In: YES user_id=249098 This bug has been fixed in 1.32.0: confirmed with libstdc++ debug mode.
  Note:
 See   TracTickets
 for help on using tickets.
    