Hi I came across this:
when calling CryptoManager::decodeBZ2, with a partially downloaded BZ2 file, it may enter a endless loop in:
while((err = BZ2_bzDecompress(&bs)) == BZ_OK) {
os.append(buf, bufsize-bs.avail_out);
bs.avail_out = bufsize;
bs.next_out = buf;
}
because it doesn't check for BZ_UNEXPECTED_EOF error.
So this may be better:
while((err = BZ2_bzDecompress(&bs)) == BZ_OK) {
if (bs.avail_in == 0 && bs.avail_out > 0) { // error: BZ_UNEXPECTED_EOF
BZ2_bzDecompressEnd(&bs);
throw CryptoException(STRING(DECOMPRESSION_ERROR));
}
os.append(buf, bufsize-bs.avail_out);
bs.avail_out = bufsize;
bs.next_out = buf;
}
at least it works.
Bug in CryptoManager.cpp?
Moderator: Moderators
Re: Bug in CryptoManager.cpp?
I've personally never experienced this (at least to my knowledge). It is good of you to mention it, though (but the next time, use the nifty "code" BBCode command, that way you'll preserve the formatting of the code).
Great work. I've implemented this into my modified version.
Sarf
---
Are you still here? The message is over. Shoo! Go away!
Great work. I've implemented this into my modified version.
Sarf
---
Are you still here? The message is over. Shoo! Go away!
Re: Bug in CryptoManager.cpp?
Yeah, I can confirm that this has happened for me. I never reported it, since I thought it was just my list that happened to be corrupt at that moment, but I guess not then.Who wrote:when calling CryptoManager::decodeBZ2, with a partially downloaded BZ2 file, it may enter a endless loop in:
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
Incomplete BZLists
I thought it was a bit odd that file lists get downloaded (seemingly) to their own directory, instead of the incomplete directory (if enabled). I have had DC++ hang when I tried to open a .bz2 list file that, it turns out, was partially downloaded.
I haven't looked at the code in question, so this might just be mistaken perceptions of what is happening.
I haven't looked at the code in question, so this might just be mistaken perceptions of what is happening.