matja / bitcoin-tool

Tool for converting Bitcoin keys and addresses
206 stars 116 forks source link

Core dump when trying example from docs #8

Closed rgasch closed 9 years ago

rgasch commented 9 years ago

When trying this (straight from your examples page), I the program crashes:

/bitcoin-tool --input-type private-key-wif --input-format base58check --input KzXVLY4ni4yznz8LJwdUmNoGpUfebSxiakXRqcGAeuhihzaVe3Rz --output-type address --output-format base58check

This is on Fedora 20, compiled from master source.

matja commented 9 years ago

Thanks for your feedback, I've reproduced the segfault in Fedora 20.

This happens because the call to EC_KEY_new_by_curve_name(NID_secp256k1) in keys.c returns NULL because OpenSSL on Fedora 20 doesn't have support for the secp256k1 curve, and that NULL is dereferenced by the following EC_KEY_get0_group() call because I failed to check the return value from EC_KEY_new_by_curve_name().

I've fixed it in commit 314daf16962168098ef8ee7e24c2e8ab12b2efcc by including the curve parameters and creating the curve manually using OpenSSL functions.

rgasch commented 9 years ago

Thank you, seems to work fine.