Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

rogpeppe
Copy link
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