[Midnightbsd-cvs] mports [23281] trunk/net-p2p/libtorrent/files/patch-fix-build-bencoders-callers-crash: add missing patch

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Mon Apr 30 19:24:45 EDT 2018


Revision: 23281
          http://svnweb.midnightbsd.org/mports/?rev=23281
Author:   laffer1
Date:     2018-04-30 19:24:45 -0400 (Mon, 30 Apr 2018)
Log Message:
-----------
add missing patch

Added Paths:
-----------
    trunk/net-p2p/libtorrent/files/patch-fix-build-bencoders-callers-crash

Added: trunk/net-p2p/libtorrent/files/patch-fix-build-bencoders-callers-crash
===================================================================
--- trunk/net-p2p/libtorrent/files/patch-fix-build-bencoders-callers-crash	                        (rev 0)
+++ trunk/net-p2p/libtorrent/files/patch-fix-build-bencoders-callers-crash	2018-04-30 23:24:45 UTC (rev 23281)
@@ -0,0 +1,45 @@
+# https://github.com/rakshasa/libtorrent/pull/99/files
+
+--- src/protocol/extensions.cc.orig	2015-08-08 17:01:32.000000000 +0200
++++ src/protocol/extensions.cc	2017-12-02 01:46:38.522736000 +0100
+@@ -394,7 +394,7 @@
+   if (m_download->info()->is_meta_download() || piece >= pieceEnd) {
+     // reject: { "msg_type" => 2, "piece" => ... }
+     m_pendingType = UT_METADATA;
+-    m_pending = build_bencode(40, "d8:msg_typei2e5:piecei%zuee", piece);
++    m_pending = build_bencode(sizeof(size_t) + 36, "d8:msg_typei2e5:piecei%zuee", piece);
+     return;
+   }
+ 
+@@ -407,7 +407,7 @@
+   // data: { "msg_type" => 1, "piece" => ..., "total_size" => ... } followed by piece data (outside of dictionary)
+   size_t length = piece == pieceEnd - 1 ? m_download->info()->metadata_size() % metadata_piece_size : metadata_piece_size;
+   m_pendingType = UT_METADATA;
+-  m_pending = build_bencode(length + 128, "d8:msg_typei1e5:piecei%zue10:total_sizei%zuee", piece, metadataSize);
++  m_pending = build_bencode((2 * sizeof(size_t)) + length + 120, "d8:msg_typei1e5:piecei%zue10:total_sizei%zuee", piece, metadataSize);
+ 
+   memcpy(m_pending.end(), buffer + (piece << metadata_piece_shift), length);
+   m_pending.set(m_pending.data(), m_pending.end() + length, m_pending.owned());
+--- src/protocol/handshake.cc.orig	2015-08-08 17:01:49.000000000 +0200
++++ src/protocol/handshake.cc	2017-12-02 01:46:38.523093000 +0100
+@@ -738,7 +738,7 @@
+         break;
+ 
+       if (m_readBuffer.remaining() > m_encryption.length_ia())
+-        throw internal_error("Read past initial payload after incoming encrypted handshake.");
++        throw handshake_error(ConnectionManager::handshake_failed, e_handshake_invalid_value);
+ 
+       if (m_encryption.crypto() != HandshakeEncryption::crypto_rc4)
+         m_encryption.info()->set_obfuscated();
+--- src/torrent/object_stream.cc.orig	2015-08-08 17:01:32.000000000 +0200
++++ src/torrent/object_stream.cc	2017-12-02 01:46:38.523350000 +0100
+@@ -104,7 +104,8 @@
+   while (first != last && *first >= '0' && *first <= '9')
+     length = length * 10 + (*first++ - '0');
+ 
+-  if (length + 1 > (unsigned int)std::distance(first, last) || *first++ != ':')
++  if (length + 1 > (unsigned int)std::distance(first, last) || *first++ != ':'
++		  || length + 1 == 0)
+     throw torrent::bencode_error("Invalid bencode data.");
+   
+   return raw_string(first, length);


Property changes on: trunk/net-p2p/libtorrent/files/patch-fix-build-bencoders-callers-crash
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property


More information about the Midnightbsd-cvs mailing list