mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
Sanitize assert usage and refuse to compile with NDEBUG.
There were quite a few places where assert() was used with side effects, making operation with NDEBUG non-functional. This commit fixes all the cases I know about, but also adds an #error on NDEBUG because the code is untested without assertions and may still have vulnerabilities if used without assert.
This commit is contained in:
@@ -148,10 +148,13 @@ public:
|
||||
}
|
||||
|
||||
void SetSecretBytes(const unsigned char vch[32]) {
|
||||
bool ret;
|
||||
BIGNUM bn;
|
||||
BN_init(&bn);
|
||||
assert(BN_bin2bn(vch, 32, &bn));
|
||||
assert(EC_KEY_regenerate_key(pkey, &bn));
|
||||
ret = BN_bin2bn(vch, 32, &bn);
|
||||
assert(ret);
|
||||
ret = EC_KEY_regenerate_key(pkey, &bn);
|
||||
assert(ret);
|
||||
BN_clear_free(&bn);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user