Test for integer overflow in when checking read requests are within the bounds of the associated piece. Another fix is required to limit the amount of memory that can be allocated for such requests.
Possibly on read buffer boundaries, this would have caused errant io.ErrUnexpectedEOF.
(cherry picked from commit 22569449dad48e1c5cdeac171625585f8ca976c9)
* Drop bradfitz/iter dependency
`range iter.N` looks nice and doesn't allocate, but unfortunately using a `range` expression blocks a function from being inlined wherever it's used (for now). It's not that we need inlining in all cases, but I do think a C-style for loop looks just as nice and is probably clearer to the majority. There also aren't any clear disadvantages to changing (unless you just happen to dislike the look of C)
* Update misc_test.go
* Update rlreader_test.go
* Update torrent_test.go
* Update bench_test.go
* Update client_test.go
* Update iplist_test.go
* Update mse_test.go
* Update peerconn_test.go
* Update peerconn.go
* Update order_test.go
* Update decoder_test.go
* Update main.go
* Update bench-piece-mark-complete.go
* Update main.go
* Update torrent.go
* Update iplist_test.go
* Update main.go
Nothing wrong with missinggo.CopyExact -- but fewer dependencies is better IMO. Also changed String() to use a consistent receiver name -- not a big deal.
* Add linter CI
Signed-off-by: Bora M. Alper <bora@boramalper.org>
* Make gosec CI ignore SHA1 and upload sarif
Signed-off-by: Bora M. Alper <bora@boramalper.org>
* Fix formatting of source files
Signed-off-by: Bora M. Alper <bora@boramalper.org>
* Make go vet ignore unkeyed composite literals and fix other warnings
Signed-off-by: Bora M. Alper <bora@boramalper.org>
* Make staticcheck ignore unused methods and fix other warnings
Signed-off-by: Bora M. Alper <bora@boramalper.org>
* Use golangci-lint
Signed-off-by: Bora M. Alper <bora@boramalper.org>
Also run the storage failure test with fast disabled for the seeder. This probably would have tickled some issues in the past, so it seems like a good place to try it out.