Browse Source

Fixed CodeQL Security Issue

add-ec-vacuum
chrislu 4 months ago
parent
commit
5bb475c572
  1. 6
      weed/storage/disk_location_ec.go

6
weed/storage/disk_location_ec.go

@ -2,6 +2,7 @@ package storage
import (
"fmt"
"math"
"os"
"path"
"regexp"
@ -124,6 +125,11 @@ func (l *DiskLocation) loadEcShards(shards []string, collection string, vid need
return fmt.Errorf("failed to parse ec shard name %v: %w", shard, err)
}
// Bounds check for uint8 (ShardId)
if shardId < 0 || shardId > int64(math.MaxUint8) {
return fmt.Errorf("ec shard id %v out of bounds for uint8 in shard name %v", shardId, shard)
}
_, err = l.LoadEcShard(collection, vid, erasure_coding.ShardId(shardId), generation)
if err != nil {
return fmt.Errorf("failed to load ec shard %v: %w", shard, err)

Loading…
Cancel
Save