Merge pull request #8396
a46b6ba
contrib: add more valgrind suppressions for spurious issues (moneromooo-monero)7f3e31d
unit_tests: fix accessing invalid memory in tree_hash test (moneromooo-monero)
This commit is contained in:
commit
8db863c415
|
@ -26,3 +26,34 @@
|
||||||
fun:_ZN2el4base7Storage7getELPPEv
|
fun:_ZN2el4base7Storage7getELPPEv
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
in boost multiprecision, we don't get a pointer to the actual code causing it but if so it's only in the test itself anyway
|
||||||
|
Memcheck:Overlap
|
||||||
|
fun:__memcpy_chk
|
||||||
|
fun:_ZL6MKHASHmm
|
||||||
|
fun:_ZN26difficulty_check_hash_Test8TestBodyEv
|
||||||
|
fun:_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
|
||||||
|
fun:_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
|
||||||
|
fun:_ZN7testing4Test3RunEv
|
||||||
|
fun:_ZN7testing8TestInfo3RunEv
|
||||||
|
fun:_ZN7testing8TestCase3RunEv
|
||||||
|
fun:_ZN7testing8internal12UnitTestImpl11RunAllTestsEv
|
||||||
|
fun:_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc
|
||||||
|
fun:_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc
|
||||||
|
fun:_ZN7testing8UnitTest3RunEv
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
valgrind seems to be confusing memmove with memcpy
|
||||||
|
Memcheck:Overlap
|
||||||
|
fun:__memcpy_chk
|
||||||
|
fun:memmove
|
||||||
|
fun:left_shift_byte<boost::multiprecision::backends::cpp_int_backend<512, 512, (boost::multiprecision::cpp_integer_type)0, (boost::multiprecision::cpp_int_check_type)0, void> >
|
||||||
|
fun:eval_left_shift<512, 512, (boost::multiprecision::cpp_integer_type)0, (boost::multiprecision::cpp_int_check_type)0, void>
|
||||||
|
fun:eval_left_shift<512, 512, (boost::multiprecision::cpp_integer_type)0, (boost::multiprecision::cpp_int_check_type)0, void>
|
||||||
|
fun:operator<<=<int>
|
||||||
|
fun:_ZN10cryptonote14check_hash_128ERKN6crypto4hashEN5boost14multiprecision6numberINS5_8backends15cpp_int_backendILj128ELj128ELNS5_16cpp_integer_typeE0ELNS5_18cpp_int_check_typeE0EvEELNS5_26expression_template_optionE0EEE
|
||||||
|
fun:_ZN10cryptonote10check_hashERKN6crypto4hashEN5boost14multiprecision6numberINS5_8backends15cpp_int_backendILj128ELj128ELNS5_16cpp_integer_typeE0ELNS5_18cpp_int_check_typeE0EvEELNS5_26expression_template_optionE0EEE
|
||||||
|
fun:_ZN26difficulty_check_hash_Test8TestBodyEv
|
||||||
|
}
|
||||||
|
|
|
@ -112,6 +112,7 @@ TEST(Crypto, tree_branch)
|
||||||
{
|
{
|
||||||
crypto::hash inputs[6];
|
crypto::hash inputs[6];
|
||||||
crypto::hash branch[8];
|
crypto::hash branch[8];
|
||||||
|
crypto::hash branch_1[8 + 1];
|
||||||
crypto::hash root, root2;
|
crypto::hash root, root2;
|
||||||
size_t depth;
|
size_t depth;
|
||||||
uint32_t path, path2;
|
uint32_t path, path2;
|
||||||
|
@ -296,12 +297,16 @@ TEST(Crypto, tree_branch)
|
||||||
ASSERT_FALSE(crypto::is_branch_in_tree(inputs[5].data, root.data, (const char(*)[32])branch, depth, path));
|
ASSERT_FALSE(crypto::is_branch_in_tree(inputs[5].data, root.data, (const char(*)[32])branch, depth, path));
|
||||||
ASSERT_FALSE(crypto::is_branch_in_tree(crypto::null_hash.data, root.data, (const char(*)[32])branch, depth, path));
|
ASSERT_FALSE(crypto::is_branch_in_tree(crypto::null_hash.data, root.data, (const char(*)[32])branch, depth, path));
|
||||||
|
|
||||||
|
// a version with an extra (dummy) hash
|
||||||
|
memcpy(branch_1, branch, sizeof(branch));
|
||||||
|
branch_1[depth] = crypto::null_hash;
|
||||||
|
|
||||||
ASSERT_FALSE(crypto::is_branch_in_tree(inputs[4].data, root.data, (const char(*)[32])branch, depth - 1, path));
|
ASSERT_FALSE(crypto::is_branch_in_tree(inputs[4].data, root.data, (const char(*)[32])branch, depth - 1, path));
|
||||||
ASSERT_FALSE(crypto::is_branch_in_tree(inputs[4].data, root.data, (const char(*)[32])branch, depth + 1, path));
|
ASSERT_FALSE(crypto::is_branch_in_tree(inputs[4].data, root.data, (const char(*)[32])branch_1, depth + 1, path));
|
||||||
ASSERT_FALSE(crypto::is_branch_in_tree(inputs[4].data, root.data, (const char(*)[32])branch, depth, path ^ 1));
|
ASSERT_FALSE(crypto::is_branch_in_tree(inputs[4].data, root.data, (const char(*)[32])branch, depth, path ^ 1));
|
||||||
ASSERT_FALSE(crypto::is_branch_in_tree(inputs[4].data, root.data, (const char(*)[32])branch, depth, path ^ 2));
|
ASSERT_FALSE(crypto::is_branch_in_tree(inputs[4].data, root.data, (const char(*)[32])branch, depth, path ^ 2));
|
||||||
ASSERT_FALSE(crypto::is_branch_in_tree(inputs[4].data, root.data, (const char(*)[32])branch, depth, path ^ 3));
|
ASSERT_FALSE(crypto::is_branch_in_tree(inputs[4].data, root.data, (const char(*)[32])branch, depth, path ^ 3));
|
||||||
ASSERT_FALSE(crypto::is_branch_in_tree(inputs[4].data, root.data, (const char(*)[32])(branch + 1), depth, path));
|
ASSERT_FALSE(crypto::is_branch_in_tree(inputs[4].data, root.data, (const char(*)[32])(branch_1 + 1), depth, path));
|
||||||
|
|
||||||
// five, not found
|
// five, not found
|
||||||
ASSERT_FALSE(crypto::tree_branch((const char(*)[32])inputs, 5, crypto::null_hash.data, (char(*)[32])branch, &depth, &path));
|
ASSERT_FALSE(crypto::tree_branch((const char(*)[32])inputs, 5, crypto::null_hash.data, (char(*)[32])branch, &depth, &path));
|
||||||
|
|
Loading…
Reference in New Issue