Corruption can't happen with invalid resetPos. Only a crash by doing 5
steps that were described by eMTee. It seems that it is really difficult
to reproduce, but this crash has already been reported 140× in
StrongDC++ 2.41 (unless there is another bug which has nothing to do
with this bug report, but I verified code and everything seems ok -
except that resetPos).

The only problem is with flush in endData, so only this one needs
resetPos in exception handler but it must be valid for all types of
exceptions (not only FileException). Another calls of flush doesn't need
to me modified.

-- 
Possible file corruption
https://bugs.launchpad.net/bugs/550300
You received this bug notification because you are a member of
Dcplusplus-team, which is a direct subscriber.

Status in DC++: Fix Committed

Bug description:
This bug happens due to following source code:

FilteredFile.h, line 141: flushed = true;

Flushed flag is set to true although file is not flushed at this time. It 
causes that flushing in DownloadManager::endData() fails, because it thinks 
that file has already been flushed. If some system error (crash, hang etc.) 
occurs, file content will be lost, because it hasn't been flushed to disk.

Another problem with same source code is there. When user's HashData is not 
accessible (e.g. no access to file, file is corrupted etc.) and client can't 
get tree from such user, it uses only simple kind of verification - by TTH 
root. It's ok, but because DownloadManager/FilteredFile thinks that the file 
has already been flushed, it doesn't verify TTH root on file finish at all. So 
even though downloaded file's TTH root is different from original TTH root 
(i.e. file is corrupted), the file is normally finished and DC++ doesn't say 
any error (but it should say "TTH inconsistency" or something).

Possible solution for both problem would be to remove that "flushed = true" 
line and reset download position when flush fails on download finish 
(DownloadManager.cpp, line 328), so such segment wouldn't be marked as 
downloaded.



_______________________________________________
Mailing list: https://launchpad.net/~linuxdcpp-team
Post to     : linuxdcpp-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~linuxdcpp-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to