oschwald / maxminddb-golang

MaxMind DB Reader for Go
ISC License
615 stars 101 forks source link

Panic on corrupt database #20

Closed oschwald closed 8 years ago

oschwald commented 8 years ago

On a database where the node count in the metadata is much larger than the actual number of nodes:

panic: runtime error: slice bounds out of range

goroutine 1 [running]:
panic(0x5419e0, 0xc820010170)
    /usr/local/go/src/runtime/panic.go:464 +0x3e6
github.com/oschwald/maxminddb-golang.FromBytes(0x7fe4b60da000, 0x1de7ce, 0x1de7ce, 0x1de7ce, 0x0, 0x0)
    /home/greg/MaxMind/go/src/github.com/oschwald/maxminddb-golang/reader.go:63 +0x419
github.com/oschwald/maxminddb-golang.Open(0x7ffe60ffce54, 0x23, 0x0, 0x0, 0x0)
    /home/greg/MaxMind/go/src/github.com/oschwald/maxminddb-golang/reader_other.go:34 +0x218
main.main()
    /home/greg/MaxMind/go/src/github.com/maxmind/mmdbverify/main.go:22 +0x10c