Opened 14 years ago
Closed 14 years ago
#397 closed defect/bug (fixed)
Infinite loop in osm2navit
Reported by: | hgavin | Owned by: | KaZeR |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | tools | Version: | git master |
Severity: | Keywords: | osm2navit | |
Cc: |
Description
If you pass in some osm-format data which defines fewer than 4 nodes and then a way, osm2navit enters an infinite loop. E.g.
<?xml version="1.0" encoding="UTF-8"?> <osm version="0.5"> <node id="1" lat="54.46355" lon="-8.189"/> <node id="2" lat="54.46439" lon="-8.18838"/> <node id="3" lat="54.46495" lon="-8.18808"/> <way id="4"> <nd ref="1"/> <nd ref="2"/> <nd ref="3"/> <tag k="highway" v="road"/> </way> </osm>
This is due to the line "int interval=count/4;" in node_item_get(). If the node count is less than 4, interval gets rounded to 0, and so the index "p" is never incremented or decremented and the loop never exits.
A simple patch is attached which simply sets interval to 1 should it be 0.
Attachments (1)
Change History (2)
Changed 14 years ago by hgavin
comment:1 Changed 14 years ago by horwitz
- Resolution set to fixed
- Status changed from new to closed
The patch has been applied to revision 2381.
Note: See
TracTickets for help on using
tickets.
Fix for infinite loop in osm2navit.c