Closed JaskaranSM closed 1 year ago
Thanks for reporting this. Looks like there's no actual checking that chunks are valid when received. It's likely a buggy or malicious peer causing this. You can send the infohash to me privately if you wish and I might debug it more accurately. Either way, the method should return an error, and it should be handled in receiveChunk. The open question is whether I should check the bounds earlier in receiveChunk than when it's attempting to be written, and whether we should try to correct the situation in case the peer is buggy.
Heres the torrents that the client was downloading when this panic occured: torrents.zip
Thanks. I'm not able to reproduce this. There's a check at https://github.com/anacrolix/torrent/blob/3e0f34934df4f109b39b5e28e674b438732a7ab8/peerconn.go#L1439 that a received chunk is expected, so it would require that we send a bad request. I tested this by running GOPPROF=http godo -race -v -- ~/ags/torrent/cmd/torrent download --file RARBG.txt torrents/*.torrent
using the provided zip. Failing some error elsewhere, there might be an off-by-one error somewhere deep in the requesting code to cause this failure. I'll keep testing, but any more info you have would be great.
Thanks, looks like fixed now :)
The client crashed with the logs as follows (pastelink):
It was downloading three torrents, The progress status:
Anacrolix/torrent version: v1.47.0 torrents.zip