merged fix from RC_1_0

This commit is contained in:
Arvid Norberg 2015-06-02 01:29:05 +00:00
parent 5d6cba438d
commit d9945f6f50
2 changed files with 10 additions and 3 deletions

View File

@ -70,6 +70,7 @@
* almost completely changed the storage interface (for custom storage)
* added support for hashing pieces in multiple threads
* fix bound-checking issue in bdecoder
* expose missing dht_settings fields to python
* add function to query the DHT settings
* fix bug in 'dont_count_slow_torrents' feature, which would start too many

View File

@ -130,7 +130,9 @@ namespace libtorrent
if (e)
TORRENT_FAIL_BDECODE(e);
if (start + len + 1 > end)
// remaining buffer size excluding ':'
const ptrdiff_t buff_size = end - start - 1;
if (len > buff_size)
TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
if (len < 0)
@ -196,15 +198,19 @@ namespace libtorrent
start = parse_int(start, end, ':', len, e);
if (e)
TORRENT_FAIL_BDECODE(e);
if (start + len + 1 > end)
// remaining buffer size excluding ':'
const ptrdiff_t buff_size = end - start - 1;
if (len > buff_size)
TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
if (len < 0)
TORRENT_FAIL_BDECODE(bdecode_errors::overflow);
++start;
if (start == end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);
top->construct_string(start, int(len));
stack.pop_back();
start += len;
stack.pop_back();
break;
}
}