From 9d02b478a6907d3be964729fd8703a103b1a0d18 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 4 Oct 2013 04:20:50 +0000 Subject: [PATCH] fix invalid read passed the allocation of peer_info in web_seed_entry --- include/libtorrent/policy.hpp | 2 +- include/libtorrent/torrent_info.hpp | 2 +- src/torrent.cpp | 5 +++++ src/torrent_info.cpp | 2 +- tools/parse_test_results.py | 5 +++-- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/libtorrent/policy.hpp b/include/libtorrent/policy.hpp index 73190ee47..003af2f9d 100644 --- a/include/libtorrent/policy.hpp +++ b/include/libtorrent/policy.hpp @@ -340,7 +340,7 @@ namespace libtorrent { ipv4_peer(tcp::endpoint const& ip, bool connectable, int src); - const address_v4 addr; + address_v4 addr; }; #if TORRENT_USE_I2P diff --git a/include/libtorrent/torrent_info.hpp b/include/libtorrent/torrent_info.hpp index 9b1db3ad5..c1fe9f780 100644 --- a/include/libtorrent/torrent_info.hpp +++ b/include/libtorrent/torrent_info.hpp @@ -281,7 +281,7 @@ namespace libtorrent // connection, just to count hash failures // it's also used to hold the peer_connection // pointer, when the web seed is connected - policy::peer peer_info; + policy::ipv4_peer peer_info; }; #ifndef BOOST_NO_EXCEPTIONS diff --git a/src/torrent.cpp b/src/torrent.cpp index 21f3d648c..0ab37b0f3 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -4851,6 +4851,11 @@ namespace libtorrent TORRENT_ASSERT(web->peer_info.connection == 0); web->endpoint = a; + if (a.address().is_v4()) + { + web->peer_info.addr = a.address().to_v4(); + web->peer_info.port = a.port(); + } if (is_paused()) return; if (m_ses.is_aborted()) return; diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index 8ddaadfc9..e1dfa0efb 100644 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -556,7 +556,7 @@ namespace libtorrent : url(url_), type(type_) , auth(auth_), extra_headers(extra_headers_) , retry(time_now()), resolving(false), removed(false) - , peer_info(0, true, 0) + , peer_info(tcp::endpoint(), true, 0) { peer_info.web_seed = true; } diff --git a/tools/parse_test_results.py b/tools/parse_test_results.py index 1efd9d17f..2f8c54131 100755 --- a/tools/parse_test_results.py +++ b/tools/parse_test_results.py @@ -59,8 +59,9 @@ def style_output(o): 'Use of uninitialised value of size' in l or \ 'Uninitialised byte(s) found during' in l: ret += '%s\n' % l - elif ': warning: ' in l or ') : warning C' in l \ - or 'Uninitialised value was created by a' in l: + elif ': warning: ' in l or ') : warning C' in or l \ + 'Uninitialised value was created by a' in l or \ + 'bytes after a block of size' in l: ret += '%s\n' % l elif l == '====== END OUTPUT ======' and not subtle: ret += '%s\n' % l