diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2023-09-18 11:00:00 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2023-09-18 11:00:00 +0900 |
| commit | 4c250f8a5ddd73e2bb02d8573bc66432c1dca7b2 (patch) | |
| tree | a3b707c4a53788915e34cacb6467bf4ab2d594db | |
| parent | 1fd0e52c41eed159d196c256770cac128ff976f2 (diff) | |
Bail out if pieceLength is 0
| -rw-r--r-- | src/DefaultBtProgressInfoFile.cc | 4 |
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) { |
