Skip to content

Commit

Permalink
Merge pull request influxdata#7086 from influxdata/jw-6990
Browse files Browse the repository at this point in the history
Fix panic with parsing empty key
  • Loading branch information
jwilder authored Jul 29, 2016
2 parents ae4a1a4 + d432aaa commit 644693a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ With this release the systemd configuration files for InfluxDB will use the syst
- [#7081](https://github.com/influxdata/influxdb/issues/7081): Hardcode auto generated RP names to autogen
- [#7088](https://github.com/influxdata/influxdb/pull/7088): Fix UDP pointsRx being incremented twice.
- [#7080](https://github.com/influxdata/influxdb/pull/7080): Ensure IDs can't clash when managing Continuous Queries.
- [#6990](https://github.com/influxdata/influxdb/issues/6990): Fix panic parsing empty key

## v0.13.0 [2016-05-12]

Expand Down
2 changes: 1 addition & 1 deletion models/points.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ func scanMeasurement(buf []byte, i int) (int, int, error) {
// Check first byte of measurement, anything except a comma is fine.
// It can't be a space, since whitespace is stripped prior to this
// function call.
if buf[i] == ',' {
if i >= len(buf) || buf[i] == ',' {
return -1, i, fmt.Errorf("missing measurement")
}

Expand Down
6 changes: 6 additions & 0 deletions models/points_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1864,3 +1864,9 @@ func TestNewPointsRejectsMaxKey(t *testing.T) {
t.Fatalf("parse point with max key. got: nil, expected: error")
}
}

func TestParseKeyEmpty(t *testing.T) {
if _, _, err := models.ParseKey(""); err != nil {
t.Fatalf("unexpected error: %v", err)
}
}

0 comments on commit 644693a

Please sign in to comment.