浏览代码

Bail out if pieceLength is 0

Tatsuhiro Tsujikawa 2 年之前
父节点
当前提交
4c250f8a5d
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/DefaultBtProgressInfoFile.cc

+ 4 - 0
src/DefaultBtProgressInfoFile.cc

@@ -289,6 +289,10 @@ void DefaultBtProgressInfoFile::load()
     pieceLength = ntohl(pieceLength);
   }
 
+  if (pieceLength == 0) {
+    throw DL_ABORT_EX("piece length must not be 0");
+  }
+
   uint64_t totalLength;
   READ_CHECK(fp, &totalLength, sizeof(totalLength));
   if (version >= 1) {