plotor / k-shortest-paths

Automatically exported from code.google.com/p/k-shortest-paths
0 stars 0 forks source link

Bug (Seldom): Seqfault Or Wrong Results. In QYShortestPath.cpp:151 (11/23/2006 Yan). Fix Provided. #14

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
CPP Version of KShortest Path. File: QYShortestPath.cpp Line 151

During my experiments: On a certain graph (Road Network Luxemburg) with
certain s-t-Relations, the KShortest Path seqfaults at line 154 cause index
out of range of vector m_vEdges.

I think thix fixes it:
Replace
for (std::size_t j = 0; j < edges_count; ++j)
with
for (std::size_t j = 0; j < m_vEdges.size(); ++j)

m_vEdges.size() can be different from edges_count since some edges may
become disconnected and hence not added to m_vEdges.
This bug is usually not discovered since m_vEdges and edges_count mostly
vary only little and a vector often reserve more space than needed so
exceeding the vector boundaries is not discoverd (and may add some random
stuff to the new graph).

Original issue reported on code.google.com by Jonathan...@googlemail.com on 23 Feb 2010 at 2:40

Attachments: