summaryrefslogtreecommitdiffstats
path: root/www/no-piece-layers-check.patch
diff options
context:
space:
mode:
Diffstat (limited to 'www/no-piece-layers-check.patch')
-rw-r--r--www/no-piece-layers-check.patch25
1 files changed, 25 insertions, 0 deletions
diff --git a/www/no-piece-layers-check.patch b/www/no-piece-layers-check.patch
new file mode 100644
index 0000000..66d7a92
--- /dev/null
+++ b/www/no-piece-layers-check.patch
@@ -0,0 +1,25 @@
+diff --git a/src/TorrentFile.php b/src/TorrentFile.php
+index 20a7f5e..eddc329 100644
+--- a/src/TorrentFile.php
++++ b/src/TorrentFile.php
+@@ -621,7 +621,7 @@ class TorrentFile
+ } else {
+ $pieceLength = $this->getPieceLength();
+ $fileTree = self::checkTorrentDict($info, 'file tree', 'array');
+- $pieceLayers = self::checkTorrentDict($this->data, 'piece layers', 'array');
++ $pieceLayers = [];
+
+ $loopMerkleTree = function (&$merkleTree, &$paths = []) use (&$files, &$size, $pieceLayers, $addFile, $pieceLength, &$loopMerkleTree) {
+ if (isset($merkleTree[''])) { // reach file
+@@ -633,11 +633,6 @@ class TorrentFile
+ }
+
+ $length = self::checkTorrentDict($file, 'length', 'integer');
+- if ($length > $pieceLength) { // check pieces root of large file is exist in $root['picec layers'] or not
+- if (!array_key_exists($piecesRoot, $pieceLayers)) {
+- throw new ParseException('Pieces not exist in piece layers.');
+- }
+- }
+
+ $addFile($paths, $length);
+ $merkleTree = $length; // rewrite merkleTree to size, it's safe since it not affect $data['info']['file tree']