summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com>2023-09-18 11:29:23 +0900
committerGitHub <noreply@github.com>2023-09-18 11:29:23 +0900
commitf05deb0cb25437b538b4efbcb4c631ad79c9d26a (patch)
treea3b707c4a53788915e34cacb6467bf4ab2d594db
parentf0015d21754ede375360c4fddb005def7ffac50a (diff)
parent4c250f8a5ddd73e2bb02d8573bc66432c1dca7b2 (diff)
Merge pull request #2106 from aria2/static-check-fix
Static check fix
-rw-r--r--src/DHTRoutingTableDeserializer.cc4
-rw-r--r--src/DefaultBtProgressInfoFile.cc4
-rw-r--r--src/UriListParser.cc4
3 files changed, 8 insertions, 4 deletions
diff --git a/src/DHTRoutingTableDeserializer.cc b/src/DHTRoutingTableDeserializer.cc
index 87b757a6..63a82c70 100644
--- a/src/DHTRoutingTableDeserializer.cc
+++ b/src/DHTRoutingTableDeserializer.cc
@@ -196,8 +196,8 @@ void DHTRoutingTableDeserializer::deserialize(const std::string& filename)
nodes.push_back(node);
}
- localNode_ = localNode;
- nodes_ = nodes;
+ localNode_ = std::move(localNode);
+ nodes_ = std::move(nodes);
A2_LOG_INFO("DHT routing table was loaded successfully");
}
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) {
diff --git a/src/UriListParser.cc b/src/UriListParser.cc
index ca021cb3..7fd2b217 100644
--- a/src/UriListParser.cc
+++ b/src/UriListParser.cc
@@ -77,7 +77,7 @@ void UriListParser::parseNext(std::vector<std::string>& uris, Option& op)
if (fp_->eof()) {
break;
}
- else if (!fp_) {
+ else if (!*fp_) {
throw DL_ABORT_EX("UriListParser:I/O error.");
}
else {
@@ -102,7 +102,7 @@ void UriListParser::parseNext(std::vector<std::string>& uris, Option& op)
if (fp_->eof()) {
return;
}
- else if (!fp_) {
+ else if (!*fp_) {
throw DL_ABORT_EX("UriListParser:I/O error.");
}
}