diff options
author | Brian Smith <brian@briansmith.org> | 2015-08-06 18:14:55 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-08-07 03:52:58 +0300 |
commit | 62138c5d5a2450c3a9da5b741048c6bb56745aed (patch) | |
tree | fbcdd1986836a610f0a640a06b1f9e06e8f0d49c /crypto/bn | |
parent | f4bbc2a3607d543693e5dcfb7eeafb4625e955b6 (diff) |
Check the return value of |BN_sub| in bn_test.cc.
Coverity complains about this.
Change-Id: I5140fd82bdbe7c2e3b36a8bc9006770a431741ea
Reviewed-on: https://boringssl-review.googlesource.com/5619
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/bn')
-rw-r--r-- | crypto/bn/bn_test.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/bn/bn_test.cc b/crypto/bn/bn_test.cc index eaceb270..f9f83d32 100644 --- a/crypto/bn/bn_test.cc +++ b/crypto/bn/bn_test.cc @@ -1188,8 +1188,9 @@ static bool test_exp(FILE *fp, BN_CTX *ctx) { if (!BN_one(e.get())) { return false; } - for (; !BN_is_zero(b.get()); BN_sub(b.get(), b.get(), BN_value_one())) { - if (!BN_mul(e.get(), e.get(), a.get(), ctx)) { + while (!BN_is_zero(b.get())) { + if (!BN_mul(e.get(), e.get(), a.get(), ctx) || + !BN_sub(b.get(), b.get(), BN_value_one())) { return false; } } |