Skip to content

Commit

Permalink
Merge pull request #9117 from influxdata/jw-exclude-panic
Browse files Browse the repository at this point in the history
Fix panic: runtime error: slice bounds out of range
  • Loading branch information
jwilder authored Nov 15, 2017
2 parents f149c9f + dde2d87 commit c3c4fd5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions tsdb/engine/tsm1/encoding.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion tsdb/engine/tsm1/encoding.gen.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
1 change: 1 addition & 0 deletions tsdb/engine/tsm1/encoding.gen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}},
Expand Down

0 comments on commit c3c4fd5

Please sign in to comment.