8000 Exception in SimpleTorrentManager.GetPeers · Issue #715 · alanmcgovern/monotorrent · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Exception in SimpleTorrentManager.GetPeers #715
Open
@johnsu

Description

@johnsu

I have a tracker server that handles many announces in quick succession.

System.ArgumentException: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
   at System.Buffer.BlockCopy(Array src, Int32 srcOffset, Array dst, Int32 dstOffset, Int32 count)
   at MonoTorrent.TrackerServer.SimpleTorrentManager.GetPeers(BEncodedDictionary response, Int32 count, Boolean compact, AddressFamily addressFamily) in C:\Projects\monotorrent\src\MonoTorrent.Client\MonoTorrent.TrackerServer\SimpleTorrentManager.cs:line 179
   at MonoTorrent.TrackerServer.TrackerServer.ListenerReceivedAnnounce(Object sender, AnnounceRequest e) in C:\Projects\monotorrent\src\MonoTorrent.Client\MonoTorrent.TrackerServer\TrackerServer.cs:line 268
   at MonoTorrent.Connections.TrackerServer.TrackerListener.Handle(NameValueCollection collection, IPAddress remoteAddress, Boolean isScrape) in C:\Projects\monotorrent\src\MonoTorrent.Trackers\MonoTorrent.Connections.TrackerServer\TrackerListener.cs:line 65

It appears to happen if you announce an ipv6 address then immediately announce the same torrent with an ipv4 address. The PeerList is remains the same length thus is not updated but the address family switches so the ipv6 peerlist will overflow the the buffer which was allocated for ipv4 stride sizes.

(int stride, Dictionary<object, Peer> peers, BEncodedString peersKey) = addressFamily switch {

Buffer.BlockCopy (current.CompactEntry, 0, compactResponse!, (total - 1) * current.CompactEntry.Length, current.CompactEntry.Length);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0