2007-07-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Fixed the bug that causes segfault when all URIs specified are
	unsupported.
	* src/RequestGroupMan.cc (getInitialCommands)
	Check if RequestGroup::createNextCommand() returns empty list of
	commands.
	* src/RequestGroup.cc (createNextCommand)
	Change log level from info to error so that users can notice 
that
	an error occurred.

	Fixed the bug that causes segfault when a zero-sized file is
	downloaded.
	* src/BitfieldMan.cc (isAllBitSet)
	Return true if bitfieldLength is 0.
pull/1/head
Tatsuhiro Tsujikawa 2007-07-09 12:54:19 +00:00
parent eab047dfba
commit 77a3820920
4 changed files with 25 additions and 3 deletions

View File

@ -1,3 +1,19 @@
2007-07-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed the bug that causes segfault when all URIs specified are
unsupported.
* src/RequestGroupMan.cc (getInitialCommands)
Check if RequestGroup::createNextCommand() returns empty list of
commands.
* src/RequestGroup.cc (createNextCommand)
Change log level from info to error so that users can notice that
an error occurred.
Fixed the bug that causes segfault when a zero-sized file is
downloaded.
* src/BitfieldMan.cc (isAllBitSet)
Return true if bitfieldLength is 0.
2007-07-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/main.cc

View File

@ -458,6 +458,9 @@ bool BitfieldMan::isFilteredAllBitSet() const {
}
bool BitfieldMan::isAllBitSet() const {
if(bitfieldLength == 0) {
return true;
}
for(int32_t i = 0; i < bitfieldLength-1; ++i) {
if(bitfield[i] != 0xff) {
return false;

View File

@ -80,8 +80,8 @@ Commands RequestGroup::createNextCommand(DownloadEngine* e, int32_t numCommand,
if(req->setUrl(uri)) {
commands.push_back(InitiateConnectionCommandFactory::createInitiateConnectionCommand(CUIDCounterSingletonHolder::instance()->newID(), req, this, e));
} else {
logger->info(_("Unrecognized URL or unsupported protocol: %s\n"),
req->getUrl().c_str());
logger->error(_("Unrecognized URL or unsupported protocol: %s\n"),
req->getUrl().c_str());
}
}
return commands;

View File

@ -91,7 +91,10 @@ Commands RequestGroupMan::getInitialCommands(DownloadEngine* e)
itr != _requestGroups.end(); ++itr) {
(*itr)->initSegmentMan();
(*itr)->setGID(++_gidCounter);
commands.push_back((*itr)->createNextCommand(e, 1).front());
Commands nextCommands = (*itr)->createNextCommand(e, 1);
if(!nextCommands.empty()) {
commands.push_back(nextCommands.front());
}
}
return commands;
}