Fix spurious bntest failures.
BN_bntest_rand generates a single-word zero BIGNUM with quite a large probability. A zero BIGNUM in turn will end up having a NULL |d|-buffer, which we shouldn't dereference without checking. Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
parent
9db0c91c39
commit
4d04226c2e
1 changed files with 2 additions and 2 deletions
|
@ -526,9 +526,9 @@ int test_div_word(BIO *bp)
|
||||||
do {
|
do {
|
||||||
BN_bntest_rand(a, 512, -1, 0);
|
BN_bntest_rand(a, 512, -1, 0);
|
||||||
BN_bntest_rand(b, BN_BITS2, -1, 0);
|
BN_bntest_rand(b, BN_BITS2, -1, 0);
|
||||||
s = b->d[0];
|
} while (BN_is_zero(b));
|
||||||
} while (!s);
|
|
||||||
|
|
||||||
|
s = b->d[0];
|
||||||
BN_copy(b, a);
|
BN_copy(b, a);
|
||||||
r = BN_div_word(b, s);
|
r = BN_div_word(b, s);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue