aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/disk_location_ec.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/storage/disk_location_ec.go')
-rw-r--r--weed/storage/disk_location_ec.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/weed/storage/disk_location_ec.go b/weed/storage/disk_location_ec.go
index e46480060..0db73adc6 100644
--- a/weed/storage/disk_location_ec.go
+++ b/weed/storage/disk_location_ec.go
@@ -124,6 +124,11 @@ func (l *DiskLocation) loadEcShards(shards []string, collection string, vid need
return fmt.Errorf("failed to parse ec shard name %v: %w", shard, err)
}
+ // Validate shardId range before converting to uint8
+ if shardId < 0 || shardId > 255 {
+ return fmt.Errorf("shard ID out of range: %d", shardId)
+ }
+
_, err = l.LoadEcShard(collection, vid, erasure_coding.ShardId(shardId))
if err != nil {
return fmt.Errorf("failed to load ec shard %v: %w", shard, err)