archive/zip: return error from NewReader when negative size is passed

This commit is contained in:
Jeet Parekh 2018-07-31 23:14:53 +05:30
parent 49b8f8b98b
commit 7900a92be1
1 changed files with 1 additions and 1 deletions

View File

@ -66,7 +66,7 @@ func OpenReader(name string) (*ReadCloser, error) {
return r, nil
}
// NewReader returns a new Reader reading from r of the given size, which cannot be negative.
// NewReader returns a new Reader reading from r, which is assumed to have the given size in bytes.
func NewReader(r io.ReaderAt, size int64) (*Reader, error) {
if size < 0 {
return nil, errors.New("zip: size cannot be negative")