Fix panic: runtime error: slice bounds out of range

Fixes #8538
pull/9086/head
Jason Wilder 2017-11-08 17:00:25 -07:00
parent 0614ebb1d1
commit ed246db55a
3 changed files with 16 additions and 1 deletions

View File

@ -1,3 +1,9 @@
## v1.5.0 [unreleased]
### Bugfixes
- [#8538](https://github.com/influxdata/influxdb/pull/8538): Fix panic: runtime error: slice bounds out of range
## v1.4.0 [unreleased]
### Breaking changes

View File

@ -1064,7 +1064,7 @@ func scanLine(buf []byte, i int) (int, []byte) {
}
// skip past escaped characters
if buf[i] == '\\' {
if buf[i] == '\\' && i+2 < len(buf) {
i += 2
continue
}

View File

@ -1341,6 +1341,15 @@ func TestParsePointQuotedTags(t *testing.T) {
)
}
func TestParsePoint_TrailingSlash(t *testing.T) {
_, err := models.ParsePointsString(`a v=1 0\`)
if err == nil {
t.Fatalf("ParsePoints failed: %v", err)
} else if !strings.Contains(err.Error(), "bad timestamp") {
t.Fatalf("ParsePoints unexpected error: %v", err)
}
}
func TestParsePointsUnbalancedQuotedTags(t *testing.T) {
pts, err := models.ParsePointsString("baz,mytag=\"a x=1 1441103862125\nbaz,mytag=a z=1 1441103862126")
if err != nil {