diff --git a/.travis.yml b/.travis.yml index 96a648e17..ff5c85bb4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,11 +46,11 @@ install: script: - cd test - - bjam --hash -j3 variant=$variant -l900 $CC + - bjam --hash -j3 warnings-as-errors=on variant=$variant -l900 $CC - cd ../examples - - bjam --hash -j3 variant=$variant $CC + - bjam --hash -j3 warnings-as-errors=on variant=$variant $CC - cd ../bindings/python - - bjam --hash -j3 variant=$variant $CC stage_module + - bjam --hash -j3 warnings-as-errors=on variant=$variant $CC stage_module - LD_LIBRARY_PATH=. python test.py - if [ $sim ]; then cd ../../simulation; diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index 987a9e3a2..48d0efe6c 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -787,6 +787,7 @@ namespace libtorrent bool has_piece_passed(int index) const { if (!valid_metadata()) return false; + if (index < 0 || index >= torrent_file().num_pieces()) return false; if (!has_picker()) return m_have_all; return m_picker->has_piece_passed(index); } diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index adc457e50..c68fe7338 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -2293,7 +2293,8 @@ namespace libtorrent bool peer_interested = bool(m_peer_interested); t->alerts().emplace_alert( t->get_handle(), m_remote, m_peer_id, r - , t->has_piece_passed(r.piece), peer_interested, false); + , t->has_piece_passed(r.piece) + , peer_interested, false); } // be lenient and pretend that the peer said it was interested