pgRouting / osm2pgrouting

Import tool for OpenStreetMap data to pgRouting database
https://pgrouting.org
GNU General Public License v2.0
293 stars 110 forks source link

Bug in Relation::members_str #305

Open sulakm opened 3 months ago

sulakm commented 3 months ago

Hi, there is a bug in method Relation::members_str.

If m_WayRefs is empty, string is written at negative index. This bug causes crash after adding restriction tag for relation element into configuration xml.

Minimalist fix would be adding space into std::string way_list("");

More efficient fix is replacing way_list[way_list.size() -1] = ' '; with this:

    size_t n = way_list.size();
    if (n > 0) way_list.resize(n - 1);

Cheers, Martin