Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot parse torrent info: bencoded item count limit exceeded #20403

Closed
axet opened this issue Feb 11, 2024 · 10 comments
Closed

Cannot parse torrent info: bencoded item count limit exceeded #20403

axet opened this issue Feb 11, 2024 · 10 comments
Labels
Invalid Issues that fail to comply with the contributing guidelines and/or issue template requirements

Comments

@axet
Copy link
Contributor

axet commented Feb 11, 2024

qBittorrent & operating system versions

qBittorrent v4.5.2
Debian Bookworm

What is the problem?

qBittorrent after adding existent torrents with contentn on a disk via torrent file loosing freshly added torrents after restart.

Steps to reproduce

  1. create torrent using Create Torrent menu item
  2. add torrent, wait until check is done.
  3. exit qbittorrent
  4. restart. check torrents list.

Additional context

torrent file:

Log(s) & preferences file(s)

11.02.2024 16:04 - IP geolocation database loaded. Type: DBIP-Country-Lite. Build time: чт февр. 1 04:17:55 2024.
11.02.2024 16:04 - Failed to resume torrent. Torrent: "85a9fabba750107a2f160885b15b1e7988f07802". Reason: "Cannot parse torrent info: bencoded item count limit exceeded"
11.02.2024 16:04 - Failed to resume torrent. Torrent: "7ab1323ee1b6ee16420d3273625946ac58aae89c". Reason: "Cannot parse torrent info: bencoded item count limit exceeded"
@axet axet changed the title qbittorrent does lose new torrents after restart Cannot parse torrent info: bencoded item count limit exceeded Feb 11, 2024
@thalieht
Copy link
Contributor

qBittorrent v4.5.2

Can't reproduce in 4.6.3.

@thalieht thalieht added the Invalid Issues that fail to comply with the contributing guidelines and/or issue template requirements label Feb 11, 2024
@axet
Copy link
Contributor Author

axet commented Feb 11, 2024

Backporting?

@thalieht
Copy link
Contributor

No. 4.5.x ended at 4.5.5.

@luzpaz
Copy link
Contributor

luzpaz commented Feb 11, 2024

Closing as obsolete. Current stable is 4.6.3

@luzpaz luzpaz closed this as not planned Won't fix, can't repro, duplicate, stale Feb 11, 2024
@axet
Copy link
Contributor Author

axet commented Feb 12, 2024

Here a few issues related to "big torrents" crash:

Since all Debian users (current release 12 Bookworm) is stuck to qbittorrent 4.5 (new release 4.6 depends on new libraries and cannot be easily migrated to current debian release), can I have commit id, I will port the patch my self.

@thalieht
Copy link
Contributor

I don't know what fixed it. It could very well be a fix in libtorrent (you didn't mention what version you use).

@axet
Copy link
Contributor Author

axet commented Feb 12, 2024

I forgot to mention, debian Bookwork just been released (10 Jun 2023). It is unlikely qbittorrent will be updated (with debian 13 Trixie release) for end users sooner than two-three years after release.

@thalieht
Copy link
Contributor

#12616

@axet
Copy link
Contributor Author

axet commented Feb 12, 2024

diff --git a/src/base/bittorrent/bencoderesumedatastorage.cpp b/src/base/bittorrent/bencoderesumedatastorage.cpp
index b6f02ce..3324da3 100644
--- a/src/base/bittorrent/bencoderesumedatastorage.cpp
+++ b/src/base/bittorrent/bencoderesumedatastorage.cpp
@@ -196,7 +196,7 @@ void BitTorrent::BencodeResumeDataStorage::loadQueue(const Path &queueFilename)
 BitTorrent::LoadResumeDataResult BitTorrent::BencodeResumeDataStorage::loadTorrentResumeData(const QByteArray &data, const QByteArray &metadata) const
 {
     lt::error_code ec;
-    const lt::bdecode_node resumeDataRoot = lt::bdecode(data, ec);
+    const lt::bdecode_node resumeDataRoot = lt::bdecode(data, ec, nullptr, 100, 10000000);
     if (ec)
         return nonstd::make_unexpected(tr("Cannot parse resume data: %1").arg(QString::fromStdString(ec.message())));
 
@@ -263,7 +263,7 @@ BitTorrent::LoadResumeDataResult BitTorrent::BencodeResumeDataStorage::loadTorre
 
     if (!metadata.isEmpty())
     {
-        const lt::bdecode_node torentInfoRoot = lt::bdecode(metadata, ec);
+        const lt::bdecode_node torentInfoRoot = lt::bdecode(metadata, ec, nullptr, 100, 10000000);
         if (ec)
             return nonstd::make_unexpected(tr("Cannot parse torrent info: %1").arg(QString::fromStdString(ec.message())));
 
diff --git a/src/base/bittorrent/dbresumedatastorage.cpp b/src/base/bittorrent/dbresumedatastorage.cpp
index fb0ce33..31d66a2 100644
--- a/src/base/bittorrent/dbresumedatastorage.cpp
+++ b/src/base/bittorrent/dbresumedatastorage.cpp
@@ -228,7 +228,7 @@ namespace BitTorrent
             const QByteArray bencodedResumeData = query.value(DB_COLUMN_RESUMEDATA.name).toByteArray();
 
             lt::error_code ec;
-            const lt::bdecode_node resumeDataRoot = lt::bdecode(bencodedResumeData, ec);
+            const lt::bdecode_node resumeDataRoot = lt::bdecode(bencodedResumeData, ec, nullptr, 100, 10000000);
 
             lt::add_torrent_params &p = resumeData.ltAddTorrentParams;
 
@@ -236,7 +236,7 @@ namespace BitTorrent
 
             if (const QByteArray bencodedMetadata = query.value(DB_COLUMN_METADATA.name).toByteArray(); !bencodedMetadata.isEmpty())
             {
-                const lt::bdecode_node torentInfoRoot = lt::bdecode(bencodedMetadata, ec);
+                const lt::bdecode_node torentInfoRoot = lt::bdecode(bencodedMetadata, ec, nullptr, 100, 10000000);
                 p.ti = std::make_shared<lt::torrent_info>(torentInfoRoot, ec);
             }

@marillat
Copy link

This patch has been tested by more than one user ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Invalid Issues that fail to comply with the contributing guidelines and/or issue template requirements
Projects
None yet
Development

No branches or pull requests

4 participants