Browse Source

Bail out if pieceLength is 0

Tatsuhiro Tsujikawa 2 năm trước cách đây
mục cha
commit
4c250f8a5d
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  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) {