go-ntfs
go-ntfs copied to clipboard
fix: Always return an error or some content from LimitedReader
The contract from io.ReaderAt requires that err != nil if less than len(p) bytes are returned, and that 0 <= n <= len(p). LimitedReader currently fulfills neither requirements:
- For off > self.N, n is negative.
- For off + n > self.N, n is limited and thus n < len(p), but no error is returned.
Add additional cases to catch these contract violations.