Public bug reported:

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.

** Affects: dcplusplus
     Importance: Undecided
         Status: New

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

Status in DC++: New

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