ArrayIndexOutOfBoundsException when using GEOIP_INDEX_CACHE #15
Comments
Thanks for the report. Although this hasn't been reported previously, it sounds like this may be a bug in the API. We will look into it. |
I'm unable to reproduce the error. bz$ ll /tmp/GeoIPCity-20130305.dat
-rw-rw-r-- 1 bz wheel 56406935 Mar 5 05:08 /tmp/GeoIPCity-20130305.dat
bz$ md5sum /tmp/GeoIPCity-20130305.dat
a343d7e750f36ab7828c9923f5388b3d /tmp/GeoIPCity-20130305.dat
bz$ geoiplookup -v -f /tmp/GeoIPCity-20130305.dat 1
GeoIP City Edition, Rev 1: GEO-133 20130305 Build 1 Copyright (c) 2012 MaxMind Inc All Rights Reserved PS: which API do you use? I could not find any LookupService.java file with 1224 lines. |
Here is the line where the exception is thrown: https://github.com/maxmind/geoip-api-java/blob/v1.2.11/src/main/java/com/maxmind/geoip/LookupService.java#L1224 Notice the version tag. 1.2.11 is the latest version available for download. |
My database file has the same MD5 sum, so I assume that you built the library from master and tested with that. The only change to that file in the last six months is the pull request that you merged two weeks ago, maybe that fixed it? In that case a new release is all that's needed to fix this issue. |
Unfortunately it's almost impossible for me to see how that PR fixed this issue since the whole LookupService class was reindented and shows up as changed. |
You can see the differences without the whitespace changes by doing a |
What JDK and platform do you use? |
I've confirmed the bug in:
and
|
I'm able to reproduce the error. |
We believe this has been fixed in master. |
When using the
GEOIP_INDEX_CACHE
I get anArrayIndexOutOfBoundsException
for two IPs (out of the whole IPv4 range, I tested them all).This is the code:
this is the error:
It happens for the IPs 223.255.245.158 and 223.255.245.159, but no other (I didn't scan the whole IPv4 space just for fun -- one of our production systems crashed and we wanted to make sure this wasn't a common issue).
As you can see I'm using a pretty old database here, and I aknowledge that this could be a problem that has gone away with newer databases. However, it doesn't happen when not using
GEOIP_INDEX_CACHE
, and even if it has gone away, there is still some bounds checking that is not happening.I have verified this with 1.2.10 and 1.2.11.
The text was updated successfully, but these errors were encountered: