xl/fs: offset and length cannot be negative. (#2121)

Fixes #2119
This commit is contained in:
Harshavardhana
2016-07-07 01:30:34 -07:00
committed by GitHub
parent 169c72cdab
commit ddf3245677
4 changed files with 18 additions and 1 deletions
+4 -1
View File
@@ -48,7 +48,10 @@ func (xl xlObjects) GetObject(bucket, object string, startOffset int64, length i
if !IsValidObjectName(object) {
return ObjectNameInvalid{Bucket: bucket, Object: object}
}
// Start offset and length cannot be negative.
if startOffset < 0 || length < 0 {
return toObjectErr(errUnexpected, bucket, object)
}
// Lock the object before reading.
nsMutex.RLock(bucket, object)
defer nsMutex.RUnlock(bucket, object)