diff options
| author | ENikS <[email protected]> | 2014-09-23 11:17:43 -0400 |
|---|---|---|
| committer | ENikS <[email protected]> | 2014-09-23 11:17:43 -0400 |
| commit | c8063b57124600ae4e8e2a65eab402d3c47babe2 (patch) | |
| tree | ba58ac08cb4f2526d107d894f09838de81d783bd /src/test/crypto_tests.cpp | |
| parent | Merge pull request #4949 (diff) | |
| download | discoin-c8063b57124600ae4e8e2a65eab402d3c47babe2.tar.xz discoin-c8063b57124600ae4e8e2a65eab402d3c47babe2.zip | |
Fixing out of bounds asses error
Diffstat (limited to 'src/test/crypto_tests.cpp')
| -rw-r--r-- | src/test/crypto_tests.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/crypto_tests.cpp b/src/test/crypto_tests.cpp index a3eec270e..68232a2ff 100644 --- a/src/test/crypto_tests.cpp +++ b/src/test/crypto_tests.cpp @@ -32,7 +32,7 @@ void TestVector(const Hasher &h, const In &in, const Out &out) { size_t len = insecure_rand() % ((in.size() - pos + 1) / 2 + 1); hasher.Write((unsigned char*)&in[pos], len); pos += len; - if (pos > 0 && pos + 2 * out.size() > in.size()) { + if (pos > 0 && pos + 2 * out.size() > in.size() && pos < in.size()) { // Test that writing the rest at once to a copy of a hasher works. Hasher(hasher).Write((unsigned char*)&in[pos], in.size() - pos).Finalize(&hash[0]); BOOST_CHECK(hash == out); |