mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
Merge pull request #109 from harshavardhana/pr_out_add_crc_checks_for_object_get_
This commit is contained in:
commit
94e11db3a8
@ -68,12 +68,20 @@ func (storage *appendStorage) Get(objectPath string) (io.Reader, error) {
|
||||
|
||||
offset := header.Offset
|
||||
length := header.Length
|
||||
crc := header.Crc
|
||||
|
||||
object := make([]byte, length)
|
||||
_, err := storage.file.ReadAt(object, offset)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
newcrc, err := crc32c.Crc32c(object)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if newcrc != crc {
|
||||
return nil, err
|
||||
}
|
||||
return bytes.NewBuffer(object), nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user