summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2023-09-18 11:00:00 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2023-09-18 11:00:00 +0900
commit4c250f8a5ddd73e2bb02d8573bc66432c1dca7b2 (patch)
treea3b707c4a53788915e34cacb6467bf4ab2d594db
parent1fd0e52c41eed159d196c256770cac128ff976f2 (diff)
Bail out if pieceLength is 0
-rw-r--r--src/DefaultBtProgressInfoFile.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/DefaultBtProgressInfoFile.cc b/src/DefaultBtProgressInfoFile.cc
index 7a5da1c3..b2161828 100644
--- a/src/DefaultBtProgressInfoFile.cc
+++ b/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) {