Fix panic with parsing empty key

Fixes #6990
pull/7086/head
Jason Wilder 2016-07-27 18:01:29 -06:00
parent ae4a1a4d00
commit d432aaa84d
3 changed files with 8 additions and 1 deletions

View File

@ -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]

View File

@ -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")
}

View File

@ -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)
}
}