1
0
Alexei Sorokin
2016-08-28 21:50:35 +00:00
committed by Git OBS Bridge
parent f3bc9a0abf
commit d478414cdc
9 changed files with 51 additions and 419 deletions

View File

@@ -1,27 +0,0 @@
From: Michel Normand <normand@linux.vnet.ibm.com>
Subject: libtorrent rasterbar 1.1.0 add ppc64le as 64 bit system libraries
Date: Fri, 29 Jul 2016 14:10:01 +0200
libtorrent rasterbar 1.1.0 add ppc64le as 64 bit system libraries
local patch waiting for upstream pull request
https://github.com/arvidn/libtorrent/pull/967
Signed-off-by: Michel Normand <normand@linux.vnet.ibm.com>
---
configure | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: libtorrent-rasterbar-1.1.0/configure
===================================================================
--- libtorrent-rasterbar-1.1.0.orig/configure
+++ libtorrent-rasterbar-1.1.0/configure
@@ -16821,7 +16821,7 @@ $as_echo_n "checking for boostlib >= $bo
libsubdirs="lib"
ax_arch=`uname -m`
case $ax_arch in
- x86_64|ppc64|s390x|sparc64|aarch64)
+ x86_64|ppc64|ppc64le|s390x|sparc64|aarch64)
libsubdirs="lib64 lib lib64"
;;
esac

View File

@@ -1,31 +0,0 @@
--- a/src/session_impl.cpp
+++ b/src/session_impl.cpp
@@ -1237,6 +1237,7 @@ namespace aux {
ip_filter const& session_impl::get_ip_filter()
{
TORRENT_ASSERT(is_single_thread());
+ if (!m_ip_filter) m_ip_filter = boost::make_shared<ip_filter>();
return *m_ip_filter;
}
--- a/test/test_ip_filter.cpp
+++ b/test/test_ip_filter.cpp
@@ -89,6 +89,18 @@ void test_rules_invariant(std::vector<ip
}
}
+TORRENT_TEST(session_get_ip_filter)
+{
+ using namespace libtorrent;
+ session ses;
+ ip_filter const& ipf = ses.get_ip_filter();
+#if TORRENT_USE_IPV6
+ TEST_EQUAL(boost::get<0>(ipf.export_filter()).size(), 1);
+#else
+ TEST_EQUAL(ipf.export_filter().size(), 1);
+#endif
+}
+
TORRENT_TEST(ip_filter)
{
using namespace libtorrent;

View File

@@ -1,262 +0,0 @@
--- a/src/http_parser.cpp
+++ b/src/http_parser.cpp
@@ -174,6 +174,7 @@ restart_response:
if (m_state == read_status)
{
TORRENT_ASSERT(!m_finished);
+ TORRENT_ASSERT(pos <= recv_buffer.end);
char const* newline = std::find(pos, recv_buffer.end, '\n');
// if we don't have a full line yet, wait.
if (newline == recv_buffer.end)
@@ -194,6 +195,7 @@ restart_response:
char const* line = pos;
++newline;
+ TORRENT_ASSERT(newline >= pos);
int incoming = int(newline - pos);
m_recv_pos += incoming;
boost::get<1>(ret) += newline - (m_recv_buffer.begin + start_pos);
@@ -227,6 +229,7 @@ restart_response:
if (m_state == read_header)
{
TORRENT_ASSERT(!m_finished);
+ TORRENT_ASSERT(pos <= recv_buffer.end);
char const* newline = std::find(pos, recv_buffer.end, '\n');
std::string line;
@@ -277,6 +280,12 @@ restart_response:
if (name == "content-length")
{
m_content_length = strtoll(value.c_str(), 0, 10);
+ if (m_content_length < 0)
+ {
+ m_state = error_state;
+ error = true;
+ return ret;
+ }
}
else if (name == "connection")
{
@@ -294,12 +303,24 @@ restart_response:
if (string_begins_no_case("bytes ", ptr)) ptr += 6;
char* end;
m_range_start = strtoll(ptr, &end, 10);
+ if (m_range_start < 0)
+ {
+ m_state = error_state;
+ error = true;
+ return ret;
+ }
if (end == ptr) success = false;
else if (*end != '-') success = false;
else
{
ptr = end + 1;
m_range_end = strtoll(ptr, &end, 10);
+ if (m_range_end < 0)
+ {
+ m_state = error_state;
+ error = true;
+ return ret;
+ }
if (end == ptr) success = false;
}
@@ -318,6 +339,7 @@ restart_response:
}
TORRENT_ASSERT(m_recv_pos <= recv_buffer.left());
+ TORRENT_ASSERT(pos <= recv_buffer.end);
newline = std::find(pos, recv_buffer.end, '\n');
}
boost::get<1>(ret) += newline - (m_recv_buffer.begin + start_pos);
@@ -347,6 +369,12 @@ restart_response:
int header_size;
if (parse_chunk_header(buf, &chunk_size, &header_size))
{
+ if (chunk_size < 0)
+ {
+ m_state = error_state;
+ error = true;
+ return ret;
+ }
if (chunk_size > 0)
{
std::pair<boost::int64_t, boost::int64_t> chunk_range(m_cur_chunk_end + header_size
@@ -419,6 +447,7 @@ restart_response:
bool http_parser::parse_chunk_header(buffer::const_interval buf
, boost::int64_t* chunk_size, int* header_size)
{
+ TORRENT_ASSERT(buf.begin <= buf.end);
char const* pos = buf.begin;
// ignore one optional new-line. This is since each chunk
@@ -429,6 +458,7 @@ restart_response:
if (pos < buf.end && pos[0] == '\n') ++pos;
if (pos == buf.end) return false;
+ TORRENT_ASSERT(pos <= buf.end);
char const* newline = std::find(pos, buf.end, '\n');
if (newline == buf.end) return false;
++newline;
@@ -441,6 +471,8 @@ restart_response:
// first, read the chunk length
*chunk_size = strtoll(pos, 0, 16);
+ if (*chunk_size < 0) return true;
+
if (*chunk_size != 0)
{
*header_size = newline - buf.begin;
--- a/test/test_http_parser.cpp
+++ b/test/test_http_parser.cpp
@@ -361,29 +361,6 @@ TORRENT_TEST(http_parser)
TEST_EQUAL(parser.headers().find("test2")->second, "bar");
}
- // test chunked encoding
-
- parser.reset();
-
- char const* chunked_input =
- "HTTP/1.1 200 OK\r\n"
- "Transfer-Encoding: chunked\r\n"
- "Content-Type: text/plain\r\n"
- "\r\n"
- "4\r\ntest\r\n4\r\n1234\r\n10\r\n0123456789abcdef\r\n"
- "0\r\n\r\n";
- received = feed_bytes(parser, chunked_input);
-
- TEST_EQUAL(strlen(chunked_input), 24 + 94)
- TEST_CHECK(received == make_tuple(24, 94, false));
- TEST_CHECK(parser.finished());
-
- char mutable_buffer[100];
- memcpy(mutable_buffer, parser.get_body().begin, parser.get_body().left());
- int len = parser.collapse_chunk_headers(mutable_buffer, parser.get_body().left());
-
- TEST_CHECK(std::equal(mutable_buffer, mutable_buffer + len, "test12340123456789abcdef"));
-
// test url parsing
error_code ec;
@@ -476,3 +453,119 @@ TORRENT_TEST(http_parser)
TEST_EQUAL(is_redirect(400), false);
}
+TORRENT_TEST(chunked_encoding)
+{
+ char const* chunked_input =
+ "HTTP/1.1 200 OK\r\n"
+ "Transfer-Encoding: chunked\r\n"
+ "Content-Type: text/plain\r\n"
+ "\r\n"
+ "4\r\ntest\r\n4\r\n1234\r\n10\r\n0123456789abcdef\r\n"
+ "0\r\n\r\n";
+
+ http_parser parser;
+ boost::tuple<int, int, bool> const received
+ = feed_bytes(parser, chunked_input);
+
+ TEST_EQUAL(strlen(chunked_input), 24 + 94)
+ TEST_CHECK(received == make_tuple(24, 94, false));
+ TEST_CHECK(parser.finished());
+
+ char mutable_buffer[100];
+ memcpy(mutable_buffer, parser.get_body().begin, parser.get_body().left());
+ int len = parser.collapse_chunk_headers(mutable_buffer, parser.get_body().left());
+
+ TEST_CHECK(std::equal(mutable_buffer, mutable_buffer + len, "test12340123456789abcdef"));
+}
+
+TORRENT_TEST(invalid_content_length)
+{
+ char const* chunked_input =
+ "HTTP/1.1 200 OK\r\n"
+ "Transfer-Encoding: chunked\r\n"
+ "Content-Length: -45345\r\n"
+ "\r\n";
+
+ http_parser parser;
+ boost::tuple<int, int, bool> const received
+ = feed_bytes(parser, chunked_input);
+
+ TEST_CHECK(boost::get<2>(received) == true);
+}
+
+TORRENT_TEST(invalid_chunked)
+{
+ char const* chunked_input =
+ "HTTP/1.1 200 OK\r\n"
+ "Transfer-Encoding: chunked\r\n"
+ "\r\n"
+ "-53465234545\r\n"
+ "foobar";
+
+ http_parser parser;
+ boost::tuple<int, int, bool> const received
+ = feed_bytes(parser, chunked_input);
+
+ TEST_CHECK(boost::get<2>(received) == true);
+}
+
+TORRENT_TEST(invalid_content_range_start)
+{
+ char const* chunked_input =
+ "HTTP/1.1 206 OK\n"
+ "Content-Range: bYTes -3-4\n"
+ "\n";
+
+ http_parser parser;
+ boost::tuple<int, int, bool> const received
+ = feed_bytes(parser, chunked_input);
+
+ TEST_CHECK(boost::get<2>(received) == true);
+}
+
+TORRENT_TEST(invalid_content_range_end)
+{
+ char const* chunked_input =
+ "HTTP/1.1 206 OK\n"
+ "Content-Range: bYTes 3--434\n"
+ "\n";
+
+ http_parser parser;
+ boost::tuple<int, int, bool> const received
+ = feed_bytes(parser, chunked_input);
+
+ TEST_CHECK(boost::get<2>(received) == true);
+}
+
+TORRENT_TEST(invalid_chunk_afl)
+{
+ boost::uint8_t const invalid_chunked_input[] = {
+ 0x48, 0x6f, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, // HoTP/1.1 200 OK
+ 0x20, 0x32, 0x30, 0x30, 0x20, 0x4f, 0x4b, 0x0d, // Cont-Length: 20
+ 0x0a, 0x43, 0x6f, 0x6e, 0x74, 0x2d, 0x4c, 0x65, // Contente: tn
+ 0x6e, 0x67, 0x74, 0x68, 0x3a, 0x20, 0x32, 0x30, // Transfer-Encoding: chunked
+ 0x0d, 0x0a, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, //
+ 0x74, 0x65, 0x3a, 0x20, 0x74, 0x6e, 0x0d, 0x0a, //
+ 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, //
+ 0x2d, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, // -89abc9abcdef
+ 0x67, 0x3a, 0x20, 0x63, 0x68, 0x75, 0x6e, 0x6b, // <20>
+ 0x65, 0x64, 0x0d, 0x0a, 0x0d, 0x0d, 0x0a, 0x0d, // T<><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>def
+ 0x0a, 0x0a, 0x2d, 0x38, 0x39, 0x61, 0x62, 0x63, // <20>
+ 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x0d, // T<><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>est-headyr: foobar
+ 0x0a, 0xd6, 0x0d, 0x0a, 0x54, 0xbd, 0xbd, 0xbd,
+ 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0x64,
+ 0x65, 0x66, 0x0d, 0x0a, 0xd6, 0x0d, 0x0a, 0x54,
+ 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd,
+ 0xbd, 0xbd, 0xbd, 0x65, 0x73, 0x74, 0x2d, 0x68,
+ 0x65, 0x61, 0x64, 0x79, 0x72, 0x3a, 0x20, 0x66,
+ 0x6f, 0x6f, 0x62, 0x61, 0x72, 0x0d, 0x0a, 0x0d,
+ 0x0a, 0x00
+ };
+
+ http_parser parser;
+ boost::tuple<int, int, bool> const received
+ = feed_bytes(parser, reinterpret_cast<char const*>(invalid_chunked_input));
+
+ TEST_CHECK(boost::get<2>(received) == true);
+}
+

View File

@@ -1,69 +0,0 @@
--- a/bindings/python/src/session.cpp
+++ b/bindings/python/src/session.cpp
@@ -106,7 +106,7 @@ namespace
std::string key = extract<std::string>(iterkeys[i]);
int sett = setting_by_name(key);
- if (sett == 0) continue;
+ if (sett < 0) continue;
TORRENT_TRY
{
@@ -497,9 +497,6 @@ namespace
}
return pieces;
}
-
- void load_asnum_db(lt::session& s, std::string file) {}
- void load_country_db(lt::session& s, std::string file) {}
#endif
entry save_state(lt::session const& s, boost::uint32_t flags)
@@ -810,7 +807,7 @@ void bind_session()
#ifndef TORRENT_NO_DEPRECATE
.def("add_feed", &add_feed)
.def("status", allow_threads(&lt::session::status))
- .def("settings", &session_get_settings)
+ .def("settings", &lt::session::settings)
.def("set_settings", &session_set_settings)
#endif
.def("get_settings", &session_get_settings)
@@ -874,8 +871,6 @@ void bind_session()
.def("set_max_connections", allow_threads(&lt::session::set_max_connections))
.def("max_connections", allow_threads(&lt::session::max_connections))
.def("num_connections", allow_threads(&lt::session::num_connections))
- .def("load_asnum_db", &load_asnum_db)
- .def("load_country_db", &load_country_db)
.def("set_max_half_open_connections", allow_threads(&lt::session::set_max_half_open_connections))
.def("set_severity_level", allow_threads(&lt::session::set_severity_level))
.def("set_alert_queue_size_limit", allow_threads(&lt::session::set_alert_queue_size_limit))
--- a/bindings/python/src/torrent_handle.cpp
+++ b/bindings/python/src/torrent_handle.cpp
@@ -193,9 +193,9 @@ void dict_to_announce_entry(dict d, anno
if (d.has_key("source"))
ae.source = extract<int>(d["source"]);
if (d.has_key("verified"))
- ae.verified = extract<int>(d["verified"]);
+ ae.verified = extract<bool>(d["verified"]);
if (d.has_key("send_stats"))
- ae.send_stats = extract<int>(d["send_stats"]);
+ ae.send_stats = extract<bool>(d["send_stats"]);
}
void replace_trackers(torrent_handle& h, object trackers)
--- a/bindings/python/src/torrent_info.cpp
+++ b/bindings/python/src/torrent_info.cpp
@@ -113,10 +113,10 @@ namespace
int get_tier(announce_entry const& ae) { return ae.tier; }
void set_tier(announce_entry& ae, int v) { ae.tier = v; }
- bool get_fail_limit(announce_entry const& ae) { return ae.fail_limit; }
+ int get_fail_limit(announce_entry const& ae) { return ae.fail_limit; }
void set_fail_limit(announce_entry& ae, int l) { ae.fail_limit = l; }
- bool get_fails(announce_entry const& ae) { return ae.fails; }
- bool get_source(announce_entry const& ae) { return ae.source; }
+ int get_fails(announce_entry const& ae) { return ae.fails; }
+ int get_source(announce_entry const& ae) { return ae.source; }
bool get_verified(announce_entry const& ae) { return ae.verified; }
bool get_updating(announce_entry const& ae) { return ae.updating; }
bool get_start_sent(announce_entry const& ae) { return ae.start_sent; }

View File

@@ -1,11 +0,0 @@
--- a/configure
+++ b/configure
@@ -20267,8 +20267,6 @@ $as_echo "#define BOOST_ASIO_HASH_MAP_BU
COMPILETIME_OPTIONS="$COMPILETIME_OPTIONS -DBOOST_ASIO_HASH_MAP_BUCKETS=1021 "
-COMPILETIME_OPTIONS="$COMPILETIME_OPTIONS -msse4.2 "
-
$as_echo "#define BOOST_EXCEPTION_DISABLE 1" >>confdefs.h

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2713df7da4aec5263ac11b6626ea966f368a5a8081103fd8f2f2ed97b5cd731d
size 3629123

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f70c82367b0980460ef95aff3e117fd4a174477892d529beec434f74d615b31f
size 3641815

View File

@@ -1,3 +1,50 @@
-------------------------------------------------------------------
Sun Aug 28 12:34:58 UTC 2016 - sor.alexei@meowr.ru
- Update to version 1.1.1:
* Update puff.c for gzip inflation.
* Add dht_bootstrap_node a setting in settings_pack (and add
default).
* Make pad-file and symlink support conform to BEP47.
* Fix piece picker bug that could result in division by zero.
* Fix value of current_tracker when all tracker failed.
* Deprecate lt_trackers extension.
* Remove load_asnum_db and load_country_db from python bindings.
* Fix a crash in session::get_ip_filter when not having set one.
* Fix filename escaping when repairing torrents with broken web
seeds.
* fix a bug where file_completed_alert would not be posted unless
file_progress had been queries by the client.
* Move files one-by-one when moving storage for a torrent.
* Fix bug in python bindings of announce_entry.
* Fix a bug related to flag_merge_resume_http_seeds flag in
add_torrent_params.
* Fixed inverted priority of incoming piece suggestions.
* Optimise allow-fast logic.
* Fix an issue where FAST extension messages were not used during
handshake.
* Fix a crash on invalid input in http_parser.
* Upgrade to libtommath 1.0.
* Fix parsing of an IPv6 endpoint with invalid port character
separator.
* Add a limited support for new x.pe parameter from BEP 9.
* Fix dht stats counters that weren't being updated.
* Make sure add_torrent_alert is always posted before other
alerts for the torrent.
* Fix a peer-class leak when settings per-torrent rate limits.
* Add a new "preformatted" type to bencode entry variant type.
* Improve Socks5 support and test coverage.
* Fix set_settings in python bindings.
* Add missing alert categories in python bindings.
* Add dht_get_peers_reply_alert alert in python bindings.
* Fix updating the node id reported to peers after changing IPs.
- Remove libtorrent-rasterbar-1.1.0-fix-get-ip-filter.patch: merged
upstream.
- Remove libtorrent-rasterbar-1.1.0-remove-x86-only-flag.patch,
libtorrent-rasterbar-1.1.0-add_ppc64le_as_64_bit_system_libraries.patch,
libtorrent-rasterbar-1.1.0-fix-invalid-input-crash.patch,
libtorrent-rasterbar-1.1.0-python-fixes.patch: fixed upstream.
-------------------------------------------------------------------
Wed Aug 17 10:13:36 UTC 2016 - sor.alexei@meowr.ru

View File

@@ -22,23 +22,13 @@
%bcond_with examples
%bcond_with tests
Name: libtorrent-rasterbar
Version: 1.1.0
Version: 1.1.1
Release: 0
Summary: Libtorrent is a C++ implementation of the BitTorrent protocol
License: BSD-3-Clause
Group: Development/Libraries/C and C++
Url: http://libtorrent.org/
Source: https://github.com/arvidn/%{_name}/releases/download/%{_name}-%{_version}/%{name}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM libtorrent-rasterbar-1.1.0-remove-x86-only-flag.patch -- Remove -msse4.2 flag (commit 680eddf).
Patch0: %{name}-1.1.0-remove-x86-only-flag.patch
# PATCH-FIX-UPSTREAM libtorrent-rasterbar-1.1.0-fix-get-ip-filter.patch boo#978600 -- Fix crash in session::get_ip_filter when not having set one (commit 66e5994).
Patch1: %{name}-1.1.0-fix-get-ip-filter.patch
# PATCH-FIX-UPSTREAM libtorrent-rasterbar-1.1.0-python-fixes.patch boo#988986 -- Fixes for Python bindings (commits e4fd45e, 80710ab, f01ac8f, 42c6376, f05fad0).
Patch2: %{name}-1.1.0-python-fixes.patch
# PATCH-FIX-UPSTREAM libtorrent-rasterbar-1.1.0-fix-invalid-input-crash.patch boo#983228 -- Fix crash on invalid input in http_parser (commit 3624ce6).
Patch3: %{name}-1.1.0-fix-invalid-input-crash.patch
# PATCH-FIX-UPSTREAM libtorrent-rasterbar-1.1.0-add_ppc64le_as_64_bit_system_libraries.patch -- Fix configure error on ppc64le (commit 487cb44).
Patch4: %{name}-1.1.0-add_ppc64le_as_64_bit_system_libraries.patch
BuildRequires: boost-devel >= 1.53
BuildRequires: gcc-c++
BuildRequires: pkgconfig
@@ -135,11 +125,6 @@ Documentation for the libtorrent-rasterbar package.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
export CFLAGS="%{optflags} -fno-strict-aliasing"