Fix secp256k1_num_set_bin handling of 0

This commit is contained in:
Pieter Wuille 2014-11-24 21:29:25 +01:00
parent d907ebc0e3
commit 99f0728f23

View file

@ -71,6 +71,10 @@ static void secp256k1_num_set_bin(secp256k1_num_t *r, const unsigned char *a, un
VERIFY_CHECK(alen > 0);
VERIFY_CHECK(alen <= 64);
int len = mpn_set_str(r->data, a, alen, 256);
if (len == 0) {
r->data[0] = 0;
len = 1;
}
VERIFY_CHECK(len <= NUM_LIMBS*2);
r->limbs = len;
r->neg = 0;