diff --git a/CHANGELOG.md b/CHANGELOG.md index 7502ebe45a..9acc7f33e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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] diff --git a/models/points.go b/models/points.go index 15564d0013..fa678b9631 100644 --- a/models/points.go +++ b/models/points.go @@ -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") } diff --git a/models/points_test.go b/models/points_test.go index ae51b381fa..e7df0bfc09 100644 --- a/models/points_test.go +++ b/models/points_test.go @@ -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) + } +}