From: Matt Joiner Date: Sun, 10 Jul 2016 13:00:52 +0000 (+1000) Subject: Piece offset computed incorrectly in Reader.readOnceAt X-Git-Tag: v1.0.0~647 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=363f042b9520aa1edf4c013b97ba483f87bcc5cb;p=btrtrc.git Piece offset computed incorrectly in Reader.readOnceAt Possibly it was only wrong on the last piece in rare circumstances. --- 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 {