View | Details | Raw Unified | Return to bug 224664
Collapse All | Expand All

(-)libtorrent/Makefile (-1 / +1 lines)
Lines 2-8 Link Here
2
2
3
PORTNAME=	libtorrent
3
PORTNAME=	libtorrent
4
PORTVERSION=	0.13.6
4
PORTVERSION=	0.13.6
5
PORTREVISION=	4
5
PORTREVISION=	5
6
CATEGORIES=	net-p2p
6
CATEGORIES=	net-p2p
7
MASTER_SITES=	http://rtorrent.net/downloads/
7
MASTER_SITES=	http://rtorrent.net/downloads/
8
8
(-)libtorrent/files/patch-fix_build_bencoders_callers_crash (+46 lines)
Line 0 Link Here
1
2
https://github.com/rakshasa/libtorrent/pull/99/files
3
4
--- src/protocol/extensions.cc.orig	2015-08-08 17:01:32.000000000 +0200
5
+++ src/protocol/extensions.cc	2017-12-02 01:46:38.522736000 +0100
6
@@ -394,7 +394,7 @@
7
   if (m_download->info()->is_meta_download() || piece >= pieceEnd) {
8
     // reject: { "msg_type" => 2, "piece" => ... }
9
     m_pendingType = UT_METADATA;
10
-    m_pending = build_bencode(40, "d8:msg_typei2e5:piecei%zuee", piece);
11
+    m_pending = build_bencode(sizeof(size_t) + 36, "d8:msg_typei2e5:piecei%zuee", piece);
12
     return;
13
   }
14
 
15
@@ -407,7 +407,7 @@
16
   // data: { "msg_type" => 1, "piece" => ..., "total_size" => ... } followed by piece data (outside of dictionary)
17
   size_t length = piece == pieceEnd - 1 ? m_download->info()->metadata_size() % metadata_piece_size : metadata_piece_size;
18
   m_pendingType = UT_METADATA;
19
-  m_pending = build_bencode(length + 128, "d8:msg_typei1e5:piecei%zue10:total_sizei%zuee", piece, metadataSize);
20
+  m_pending = build_bencode((2 * sizeof(size_t)) + length + 120, "d8:msg_typei1e5:piecei%zue10:total_sizei%zuee", piece, metadataSize);
21
 
22
   memcpy(m_pending.end(), buffer + (piece << metadata_piece_shift), length);
23
   m_pending.set(m_pending.data(), m_pending.end() + length, m_pending.owned());
24
--- src/protocol/handshake.cc.orig	2015-08-08 17:01:49.000000000 +0200
25
+++ src/protocol/handshake.cc	2017-12-02 01:46:38.523093000 +0100
26
@@ -738,7 +738,7 @@
27
         break;
28
 
29
       if (m_readBuffer.remaining() > m_encryption.length_ia())
30
-        throw internal_error("Read past initial payload after incoming encrypted handshake.");
31
+        throw handshake_error(ConnectionManager::handshake_failed, e_handshake_invalid_value);
32
 
33
       if (m_encryption.crypto() != HandshakeEncryption::crypto_rc4)
34
         m_encryption.info()->set_obfuscated();
35
--- src/torrent/object_stream.cc.orig	2015-08-08 17:01:32.000000000 +0200
36
+++ src/torrent/object_stream.cc	2017-12-02 01:46:38.523350000 +0100
37
@@ -104,7 +104,8 @@
38
   while (first != last && *first >= '0' && *first <= '9')
39
     length = length * 10 + (*first++ - '0');
40
 
41
-  if (length + 1 > (unsigned int)std::distance(first, last) || *first++ != ':')
42
+  if (length + 1 > (unsigned int)std::distance(first, last) || *first++ != ':'
43
+		  || length + 1 == 0)
44
     throw torrent::bencode_error("Invalid bencode data.");
45
   
46
   return raw_string(first, length);

Return to bug 224664