File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
vertical-pod-autoscaler/recommender/util Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package util
1818
1919import (
2020 "errors"
21+ "fmt"
2122 "math"
2223)
2324
@@ -94,6 +95,9 @@ func (o *linearHistogramOptions) FindBucket(value float64) int {
9495}
9596
9697func (o * linearHistogramOptions ) GetBucketStart (bucket int ) float64 {
98+ if bucket < 0 || bucket >= o .numBuckets {
99+ panic (fmt .Sprintf ("index %d out of range [0..%d]" , bucket , o .numBuckets - 1 ))
100+ }
97101 return float64 (bucket ) * o .bucketSize
98102}
99103
@@ -117,6 +121,9 @@ func (o *exponentialHistogramOptions) FindBucket(value float64) int {
117121}
118122
119123func (o * exponentialHistogramOptions ) GetBucketStart (bucket int ) float64 {
124+ if bucket < 0 || bucket >= o .numBuckets {
125+ panic (fmt .Sprintf ("index %d out of range [0..%d]" , bucket , o .numBuckets - 1 ))
126+ }
120127 if bucket == 0 {
121128 return 0.0
122129 }
You can’t perform that action at this time.
0 commit comments