logo separator

[mkgmap-dev] Crash in fixAnglesInShape

From Steve Ratcliffe steve at parabola.me.uk on Tue Sep 2 21:19:28 BST 2014

Hi

A bug was reported which I can reproduce with the following stack trace:

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:635)
	at java.util.ArrayList.get(ArrayList.java:411)
	at 
uk.me.parabola.mkgmap.osmstyle.WrongAngleFixer.fixAnglesInShape(WrongAngleFixer.java:1401)
	at 
uk.me.parabola.mkgmap.filters.ShapeMergeFilter.merge(ShapeMergeFilter.java:123)
	at 
uk.me.parabola.mkgmap.build.MapBuilder.processShapes(MapBuilder.java:1075)
	at 
uk.me.parabola.mkgmap.build.MapBuilder.makeSubdivision(MapBuilder.java:740)

This is caused by a shape that consists of many points very close
together eg:

  [2405169/355005, 2405169/355004, 2405169/355004, 2405169/355001,
  2405169/355001, 2405169/355001, 2405164/355001, 2405164/355001,
  2405164/355001, 2405164/355005, 2405164/355009, 2405164/355009,
  2405164/355009, 2405169/355009, 2405169/355009, 2405169/355009,
  2405169/355007, 2405169/355007, 2405169/355005]

This results in the modifiedPoints list inside fixAnglesInShape() to
be empty.  The caller expects an empty list, but the last line that
closes the polygon fails if the list is empty.

The attached patch fixes the crash, but perhaps the situation should
be dealt with differently. Any comments?

..Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fixAnglesInShape_crash.patch
Type: text/x-patch
Size: 689 bytes
Desc: not available
URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20140902/c3be5c47/attachment.bin>


More information about the mkgmap-dev mailing list