Merge pull request #4966
c8063b5
Fixing out of bounds asses error (ENikS)
This commit is contained in:
commit
29a9d4483e
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
size_t len = insecure_rand() % ((in.size() - pos + 1) / 2 + 1);
|
||||||
hasher.Write((unsigned char*)&in[pos], len);
|
hasher.Write((unsigned char*)&in[pos], len);
|
||||||
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.
|
// 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]);
|
Hasher(hasher).Write((unsigned char*)&in[pos], in.size() - pos).Finalize(&hash[0]);
|
||||||
BOOST_CHECK(hash == out);
|
BOOST_CHECK(hash == out);
|
||||||
|
|
Loading…
Reference in a new issue