Bug in CryptoManager.cpp?

Technical discussion about the NMDC and <a href="http://dcpp.net/ADC.html">ADC</A> protocol. The NMDC protocol is documented in the <a href="http://dcpp.net/wiki/">Wiki</a>, so feel free to refer to it.

Moderator: Moderators

Locked

Have you ever experimented a hangout when opening some filelists?

Poll ended at 2003-02-14 06:00

Yes, sure!
0
No votes
Now you mention it.
0
No votes
Never heard of that before
5
100%
 
Total votes: 5

Who
Posts: 10
Joined: 2003-01-28 10:47
Contact:

Bug in CryptoManager.cpp?

Post by Who » 2003-02-07 06:00

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.

sarf
Posts: 382
Joined: 2003-01-24 05:43
Location: Sweden
Contact:

Re: Bug in CryptoManager.cpp?

Post by sarf » 2003-02-07 12:43

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!

sandos
Posts: 186
Joined: 2003-01-05 10:16
Contact:

Re: Bug in CryptoManager.cpp?

Post by sandos » 2003-02-07 13:22

Who wrote:when calling CryptoManager::decodeBZ2, with a partially downloaded BZ2 file, it may enter a endless loop in:
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.

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Incomplete BZLists

Post by GargoyleMT » 2003-02-12 12:23

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.

Locked