From 84759d4f20d77d32a0b635844df654cad3b2020a Mon Sep 17 00:00:00 2001 From: Falco Date: Sat, 21 Jan 2017 14:35:09 +0100 Subject: [PATCH] fix index overflow for torrents with invalid meta data or empty progress --- src/base/bittorrent/torrenthandle.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/base/bittorrent/torrenthandle.cpp b/src/base/bittorrent/torrenthandle.cpp index 054cea78a..0971a2ea9 100644 --- a/src/base/bittorrent/torrenthandle.cpp +++ b/src/base/bittorrent/torrenthandle.cpp @@ -1701,6 +1701,11 @@ void TorrentHandle::manageIncompleteFiles() { const bool isAppendExtensionEnabled = m_session->isAppendExtensionEnabled(); QVector fp = filesProgress(); + if( fp.size() != filesCount() ) { + qDebug() << "skip manageIncompleteFiles because of invalid torrent meta-data or empty file-progress"; + return; + } + for (int i = 0; i < filesCount(); ++i) { QString name = filePath(i); if (isAppendExtensionEnabled && (fileSize(i) > 0) && (fp[i] < 1)) {