mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
fix: decode published segment fields strictly
This commit is contained in:
1 parent
6a2bd2a4e3
commit
2e8954aae0
1 file changed
+5
@@ -165,6 +165,11 @@ func (r *ChunkRemote) resolveManifest(ctx context.Context, h storage.ChunkHead)
|
||||
if err := decodeManifestJSON(body, &doc); err != nil {
|
||||
return h, err
|
||||
}
|
||||
decoder := json.NewDecoder(bytes.NewReader(body))
|
||||
decoder.DisallowUnknownFields()
|
||||
if err := decoder.Decode(&doc); err != nil {
|
||||
return h, err
|
||||
}
|
||||
if doc.Format != 1 || doc.Range != group || doc.ChunkBytes != h.ChunkBytes || doc.Owner != ref.Owner || len(doc.Chunks) != ref.Count {
|
||||
return h, errors.New("chunkstore: invalid segment contents")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user