JavadocMD / simplelatlng

A simple, lightweight library for common latitude and longitude calculation needs in Java.
90 stars 20 forks source link

Geohasher.decode throws ArrayIndexOutOfBoundsException for long inputs #16

Closed JavadocMD closed 2 years ago

JavadocMD commented 2 years ago

Geohasher throws an exception when decoding a hash of more than 12 characters (with default configuration). This should instead silently truncate to the number of characters allowed for the configured precision.

Geohasher.decode("spuxq0mctb6uz"); // throws java.lang.ArrayIndexOutOfBoundsException
JavadocMD commented 2 years ago

Another poorly-handled edge-case:

Geohasher.decode(""); // throws java.lang.ArrayIndexOutOfBoundsException