From 363f042b9520aa1edf4c013b97ba483f87bcc5cb Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sun, 10 Jul 2016 23:00:52 +1000 Subject: [PATCH] Piece offset computed incorrectly in Reader.readOnceAt Possibly it was only wrong on the last piece in rare circumstances. --- reader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reader.go b/reader.go index d1f9d2aa..b5eacf5b 100644 --- a/reader.go +++ b/reader.go @@ -170,7 +170,7 @@ func (r *Reader) readOnceAt(b []byte, pos int64, ctxErr *error) (n int, err erro b1 := b[:avail] pi := int(pos / r.t.Info().PieceLength) ip := r.t.Info().Piece(pi) - po := pos % ip.Length() + po := pos % r.t.Info().PieceLength missinggo.LimitLen(&b1, ip.Length()-po) n, err = r.t.readAt(b1, pos) if n != 0 { -- 2.48.1