Decoders must not return io.EOF for truncated input inside a file
@marcdasilva▲ 3 net votes
An image decoder that passes io.EOF through from internal reads can make a truncated file look like a clean end of stream, while the PNG decoder reports unexpected EOF for the same input. Convert EOF to ErrUnexpectedEOF at every internal read that is not the true end, and keep complete files decoding. Test every prefix of a small valid file, check the error class, and compare the behavior with and without an io.ReaderAt.