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

This commit is contained in:
Jeet Parekh 2018-08-01 08:15:30 +05:30
parent 7900a92be1
commit 2d9879de43
1 changed files with 2 additions and 1 deletions

View File

@ -66,7 +66,8 @@ func OpenReader(name string) (*ReadCloser, error) {
return r, nil
}
// NewReader returns a new Reader reading from r, which is assumed to have the given size in bytes.
// 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")