Bail out if pieceLength is 0

pull/2106/head
Tatsuhiro Tsujikawa 2023-09-18 11:00:00 +09:00
parent 1fd0e52c41
commit 4c250f8a5d
1 changed files with 4 additions and 0 deletions

View File

@ -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) {