[Mono-list] MonoTorrent error + fix
alan.mcgovern at gmail.com
Sun Jan 21 18:10:50 EST 2007
I was away on holidays, so i only got the bug report now.
I created a file which was over int.MaxValue bytes in length and used that
to test the monotorrent code. I came across a few places where i was getting
int overflows and commited fixes to SVN. Everything should be ok now
(fingers crossed ;) ).
Let me know how you get on.
On 1/16/07, Will Murnane <will.murnane at gmail.com> wrote:
> I'm writing a BitTorrent client using the bitsharp library, and I
> encountered an error with a torrent that has total file size > 4GB.
> The problem occurs on line 124 of PieceMessage.cs:
> long pieceOffset = this.startOffset + this.PieceIndex *
> this.PieceIndex and this.fileManager.PieceLength are both 32-bit ints;
> when they're multiplied an overflow can result, and pass an
> (overflowed) negative value to FileManager.Read. My suggestion is to
> cast one of them to long before the multiply is performed:
> long pieceOffset = this.startOffset + (long)this.PieceIndex *
> That should fix the problem. Here's a screenshot of the debugger
> helping me find the problem:
> Last, thanks for the cool library! I was afraid I'd have to write my
> own bittorrent library to get this working, but bitsharp is working
> (mostly :-P) nicely.
> Mono-list maillist - Mono-list at lists.ximian.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-list