improve valgrind runs of test_dht

This commit is contained in:
Arvid Norberg 2013-10-14 07:43:18 +00:00
parent 8b2f561863
commit 5388f0af74
2 changed files with 12 additions and 1 deletions

View File

@ -14,7 +14,7 @@ clean:
time_limit: 180
features:
- variant=release asserts=production invariant-checks=off debug-iterators=off
- variant=release asserts=production invariant-checks=off debug-iterators=off debug-symbols=on
- encryption=openssl statistics=on logging=verbose disk-stats=on dht=logging request-log=on
- ipv6=off dht=off extensions=off logging=none deprecated-functions=off

View File

@ -55,6 +55,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include "ed25519.h"
#ifdef TORRENT_USE_VALGRIND
#include <valgrind/memcheck.h>
#endif
namespace libtorrent { namespace dht
{
@ -962,7 +966,14 @@ void node_impl::incoming_request(msg const& m, entry& e)
std::pair<char const*, int> buf = msg_keys[1]->data_section();
memcpy(seq + len, buf.first, buf.second);
len += buf.second;
TORRENT_ASSERT(len <= 1020);
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_MEM_IS_DEFINED(buf.first, buf.second);
VALGRIND_CHECK_MEM_IS_DEFINED(msg_keys[4]->string_ptr(), 64);
VALGRIND_CHECK_MEM_IS_DEFINED(msg_keys[3]->string_ptr(), 32);
VALGRIND_CHECK_MEM_IS_DEFINED(seq, len);
#endif
// msg_keys[4] is the signature, msg_keys[3] is the public key
if (ed25519_verify((unsigned char const*)msg_keys[4]->string_ptr()
, (unsigned char const*)seq, len