fix invalid read passed the allocation of peer_info in web_seed_entry

This commit is contained in:
Arvid Norberg 2013-10-04 04:20:50 +00:00
parent 0a230d4b25
commit 9d02b478a6
5 changed files with 11 additions and 5 deletions

View File

@ -340,7 +340,7 @@ namespace libtorrent
{ {
ipv4_peer(tcp::endpoint const& ip, bool connectable, int src); ipv4_peer(tcp::endpoint const& ip, bool connectable, int src);
const address_v4 addr; address_v4 addr;
}; };
#if TORRENT_USE_I2P #if TORRENT_USE_I2P

View File

@ -281,7 +281,7 @@ namespace libtorrent
// connection, just to count hash failures // connection, just to count hash failures
// it's also used to hold the peer_connection // it's also used to hold the peer_connection
// pointer, when the web seed is connected // pointer, when the web seed is connected
policy::peer peer_info; policy::ipv4_peer peer_info;
}; };
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS

View File

@ -4851,6 +4851,11 @@ namespace libtorrent
TORRENT_ASSERT(web->peer_info.connection == 0); TORRENT_ASSERT(web->peer_info.connection == 0);
web->endpoint = a; 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 (is_paused()) return;
if (m_ses.is_aborted()) return; if (m_ses.is_aborted()) return;

View File

@ -556,7 +556,7 @@ namespace libtorrent
: url(url_), type(type_) : url(url_), type(type_)
, auth(auth_), extra_headers(extra_headers_) , auth(auth_), extra_headers(extra_headers_)
, retry(time_now()), resolving(false), removed(false) , retry(time_now()), resolving(false), removed(false)
, peer_info(0, true, 0) , peer_info(tcp::endpoint(), true, 0)
{ {
peer_info.web_seed = true; peer_info.web_seed = true;
} }

View File

@ -59,8 +59,9 @@ def style_output(o):
'Use of uninitialised value of size' in l or \ 'Use of uninitialised value of size' in l or \
'Uninitialised byte(s) found during' in l: 'Uninitialised byte(s) found during' in l:
ret += '<span class="compile-error">%s</span>\n' % l ret += '<span class="compile-error">%s</span>\n' % l
elif ': warning: ' in l or ') : warning C' in l \ elif ': warning: ' in l or ') : warning C' in or l \
or 'Uninitialised value was created by a' in l: 'Uninitialised value was created by a' in l or \
'bytes after a block of size' in l:
ret += '<span class="compile-warning">%s</span>\n' % l ret += '<span class="compile-warning">%s</span>\n' % l
elif l == '====== END OUTPUT ======' and not subtle: elif l == '====== END OUTPUT ======' and not subtle:
ret += '<span class="subtle">%s\n' % l ret += '<span class="subtle">%s\n' % l