Make isIndexedMetaV2 return errors (#15012)

Indexed streams would be decoded by the legacy loader if there 
was an error loading it. Return an error when the stream is indexed 
and it cannot be loaded.

Fixes "unknown minor metadata version" on corrupted xl.meta files and 
returns an actual error.
This commit is contained in:
Klaus Post
2022-05-31 19:06:57 -07:00
committed by GitHub
parent 7b2198f7e5
commit f7cecf0945
4 changed files with 23 additions and 17 deletions

View File

@@ -514,7 +514,7 @@ func BenchmarkXlMetaV2Shallow(b *testing.B) {
b.ResetTimer()
b.ReportAllocs()
for i := 0; i < b.N; i++ {
buf, _ := isIndexedMetaV2(enc)
buf, _, _ := isIndexedMetaV2(enc)
if buf == nil {
b.Fatal("buf == nil")
}
@@ -529,7 +529,7 @@ func BenchmarkXlMetaV2Shallow(b *testing.B) {
b.ResetTimer()
b.ReportAllocs()
for i := 0; i < b.N; i++ {
buf, _ := isIndexedMetaV2(enc)
buf, _, _ := isIndexedMetaV2(enc)
if buf == nil {
b.Fatal("buf == nil")
}