PaddeK / node-maxmind-db

This is the pure Node API for reading MaxMind DB files. MaxMind DB is a binary file format that stores data indexed by IP address subnets (IPv4 or IPv6).
GNU Lesser General Public License v2.1
88 stars 25 forks source link

node-maxmind-db hangs indefinitely on feeding corrupt db file #15

Closed rajeshsegu closed 9 years ago

rajeshsegu commented 9 years ago

Have a zero bytes db file

> touch GeoIP2-City-Zero.mmdb

node.js

var MaxMindDBReader = require('maxmind-db-reader');
MaxMindDBReader.openSync(<dbPath-to-GeoIP2-City-Zero.mmdb>)

the module gets stuck and never errors out. Can we fix this please ??

rajeshsegu commented 9 years ago

@PaddeK @EaterOfCode looks like this use-case resulted in infinite while loop, rectified with code changes and also added unit tests. Do review my pull request and let me know if you want me to make further changes.

Any plans to work on node-geoip2 library, I would be happy to contribute.

the-eater commented 9 years ago

Thanks for the help, feel free to make more pull requests.