Skip to content

Commit

Permalink
Fix panic: runtime error: slice bounds out of range
Browse files Browse the repository at this point in the history
Fixes #8538
  • Loading branch information
jwilder committed Nov 9, 2017
1 parent 0614ebb commit ed246db
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion models/points.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
9 changes: 9 additions & 0 deletions models/points_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ed246db

Please sign in to comment.