Open mfp opened 6 years ago
When Maxminddb.create fails (e.g. because it is given a path to a non-existent file), a custom block is created and not initialized properly: https://github.com/fxfactorial/ocaml-maxminddb/blob/888e2ebb3b09ff1b1cf3889e9ba24174fb6ea498/src/maxminddb_stubs.c#L122-L124 (where check_status raises an Invalid_argument error if the MMDB handle could not be created). Eventually, the custom block is recovered, and its finalizer function calls MMDB_close on an invalid MMDB handle, thus segfaulting.
Maxminddb.create
check_status
Invalid_argument
MMDB_close
Thank you,
Open to PRs or I will have to get to this in about six weeks.
When
Maxminddb.create
fails (e.g. because it is given a path to a non-existent file), a custom block is created and not initialized properly: https://github.com/fxfactorial/ocaml-maxminddb/blob/888e2ebb3b09ff1b1cf3889e9ba24174fb6ea498/src/maxminddb_stubs.c#L122-L124 (wherecheck_status
raises anInvalid_argument
error if the MMDB handle could not be created). Eventually, the custom block is recovered, and its finalizer function callsMMDB_close
on an invalid MMDB handle, thus segfaulting.