diff --git a/CHANGELOG.md b/CHANGELOG.md index cdad426e012..061e8a83893 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,12 @@ - [#9065](https://github.com/influxdata/influxdb/pull/9065): Refuse extra arguments to influx CLI +## v1.4.2 [unreleased] + +### Bugfixes + +- [#9117](https://github.com/influxdata/influxdb/pull/9117): Fix panic: runtime error: slice bounds out of range + ## v1.4.1 [2017-11-13] ### Bugfixes diff --git a/tsdb/engine/tsm1/encoding.gen.go b/tsdb/engine/tsm1/encoding.gen.go index 3b7e187807d..b5c884394cf 100644 --- a/tsdb/engine/tsm1/encoding.gen.go +++ b/tsdb/engine/tsm1/encoding.gen.go @@ -162,7 +162,7 @@ func (a Values) search(v int64) int { // a[len-1].UnixNano() < min then FindRange returns (-1, -1) // indicating the array is outside the [min, max]. func (a Values) FindRange(min, max int64) (int, int) { - if len(a) == 0 { + if len(a) == 0 || min > max { return -1, -1 } @@ -374,7 +374,7 @@ func (a FloatValues) search(v int64) int { // a[len-1].UnixNano() < min then FindRange returns (-1, -1) // indicating the array is outside the [min, max]. func (a FloatValues) FindRange(min, max int64) (int, int) { - if len(a) == 0 { + if len(a) == 0 || min > max { return -1, -1 } @@ -630,7 +630,7 @@ func (a IntegerValues) search(v int64) int { // a[len-1].UnixNano() < min then FindRange returns (-1, -1) // indicating the array is outside the [min, max]. func (a IntegerValues) FindRange(min, max int64) (int, int) { - if len(a) == 0 { + if len(a) == 0 || min > max { return -1, -1 } @@ -886,7 +886,7 @@ func (a UnsignedValues) search(v int64) int { // a[len-1].UnixNano() < min then FindRange returns (-1, -1) // indicating the array is outside the [min, max]. func (a UnsignedValues) FindRange(min, max int64) (int, int) { - if len(a) == 0 { + if len(a) == 0 || min > max { return -1, -1 } @@ -1142,7 +1142,7 @@ func (a StringValues) search(v int64) int { // a[len-1].UnixNano() < min then FindRange returns (-1, -1) // indicating the array is outside the [min, max]. func (a StringValues) FindRange(min, max int64) (int, int) { - if len(a) == 0 { + if len(a) == 0 || min > max { return -1, -1 } @@ -1398,7 +1398,7 @@ func (a BooleanValues) search(v int64) int { // a[len-1].UnixNano() < min then FindRange returns (-1, -1) // indicating the array is outside the [min, max]. func (a BooleanValues) FindRange(min, max int64) (int, int) { - if len(a) == 0 { + if len(a) == 0 || min > max { return -1, -1 } diff --git a/tsdb/engine/tsm1/encoding.gen.go.tmpl b/tsdb/engine/tsm1/encoding.gen.go.tmpl index 89db2800b88..08cd5ec5ec7 100644 --- a/tsdb/engine/tsm1/encoding.gen.go.tmpl +++ b/tsdb/engine/tsm1/encoding.gen.go.tmpl @@ -159,7 +159,7 @@ func (a {{.Name}}Values) search(v int64) int { // a[len-1].UnixNano() < min then FindRange returns (-1, -1) // indicating the array is outside the [min, max]. func (a {{.Name}}Values) FindRange(min, max int64) (int, int) { - if len(a) == 0 { + if len(a) == 0 || min > max { return -1, -1 } diff --git a/tsdb/engine/tsm1/encoding.gen_test.go b/tsdb/engine/tsm1/encoding.gen_test.go index f9e3645c9aa..3e684ea030d 100644 --- a/tsdb/engine/tsm1/encoding.gen_test.go +++ b/tsdb/engine/tsm1/encoding.gen_test.go @@ -74,6 +74,7 @@ func TestIntegerValues_Exclude(t *testing.T) { min, max int64 exp []int64 }{ + {"excl bad range", 18, 11, []int64{10, 12, 14, 16, 18}}, {"excl none-lo", 0, 9, []int64{10, 12, 14, 16, 18}}, {"excl none-hi", 19, 30, []int64{10, 12, 14, 16, 18}}, {"excl first", 0, 10, []int64{12, 14, 16, 18}},