Skip to content

fix: plugins/parsers/influx: avoid ParseError.Error panic#8177

Merged
ssoroka merged 1 commit intoinfluxdata:masterfrom
rogpeppe-contrib:rogpeppe-001-fix-parse-error
Sep 30, 2020
Merged

fix: plugins/parsers/influx: avoid ParseError.Error panic#8177
ssoroka merged 1 commit intoinfluxdata:masterfrom
rogpeppe-contrib:rogpeppe-001-fix-parse-error

Conversation

@rogpeppe
Copy link
Copy Markdown
Contributor

A line ends at \n or \r\n, but not \r on its own. The ParseError.Error
logic was assuming that any carriage return terminates the line.
This caused a crash when the buffer is big, there's a single \r character and the
error offset was after that, because it assumed that the offset is always before
the end of the current line (a reasonable assumption as long as the line-termination
logic agrees between the Error method and the parsing code).

This bug found by running go-fuzz.

Required for all PRs:

  • Signed CLA.
  • Has appropriate unit tests.

A line ends at `\n` or `\r\n`, but not `\r` on its own. The ParseError.Error
logic was assuming that any carriage return terminates the line.
This caused a crash when the buffer is big, there's a single `\r` character and the
error offset was after that, because it assumed that the offset is always before
the end of the current line (a reasonable assumption as long as the line-termination
logic agrees between the Error method and the parsing code).

This bug found by running `go-fuzz`.
@sjwang90 sjwang90 added the fix pr to fix corresponding bug label Sep 25, 2020
@ssoroka ssoroka merged commit 9ee87ab into influxdata:master Sep 30, 2020
arstercz pushed a commit to arstercz/telegraf that referenced this pull request Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix pr to fix corresponding bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants