KAFKA-10574: Fix infinite loop in Values::parseString - #9375
Merged
Conversation
Contributor
Author
|
@rhauch @kkonstantine can one of you take a look? |
kkonstantine
approved these changes
Oct 5, 2020
kkonstantine
reviewed
Oct 5, 2020
kkonstantine
left a comment
Contributor
There was a problem hiding this comment.
fyi: jobs fail with checkstyle errors
kkonstantine
requested changes
Oct 5, 2020
kkonstantine
left a comment
Contributor
There was a problem hiding this comment.
Need to fix checkstyle before merging.
Contributor
Author
|
Thanks @kkonstantine, I've added a comment and addressed the Checkstyle issues. |
kkonstantine
approved these changes
Oct 5, 2020
kkonstantine
left a comment
Contributor
There was a problem hiding this comment.
LGTM after the latest fixes
Contributor
Author
|
Hi @rhauch @kkonstantine, this PR has been approved, all merge conflicts have been resolved, and every build is green. Would it be possible to merge sometime soon so that it can be backported to bug fix releases and avoid accruing merge conflicts in case the files touched here are modified in other PRs? Thanks! |
rhauch
pushed a commit
that referenced
this pull request
Oct 12, 2020
Fix infinite loop in Values::parseString Author: Chris Egerton <chrise@confluent.io> Reviewers: Konstantine Karantasis <konstantine@confluent.io>, Randall Hauch <rhauch@gmail.com>
rhauch
pushed a commit
that referenced
this pull request
Oct 12, 2020
Fix infinite loop in Values::parseString Author: Chris Egerton <chrise@confluent.io> Reviewers: Konstantine Karantasis <konstantine@confluent.io>, Randall Hauch <rhauch@gmail.com>
rhauch
pushed a commit
that referenced
this pull request
Oct 12, 2020
Fix infinite loop in Values::parseString Author: Chris Egerton <chrise@confluent.io> Reviewers: Konstantine Karantasis <konstantine@confluent.io>, Randall Hauch <rhauch@gmail.com>
rhauch
pushed a commit
that referenced
this pull request
Oct 12, 2020
Fix infinite loop in Values::parseString Author: Chris Egerton <chrise@confluent.io> Reviewers: Konstantine Karantasis <konstantine@confluent.io>, Randall Hauch <rhauch@gmail.com>
rhauch
pushed a commit
that referenced
this pull request
Oct 12, 2020
Fix infinite loop in Values::parseString Author: Chris Egerton <chrise@confluent.io> Reviewers: Konstantine Karantasis <konstantine@confluent.io>, Randall Hauch <rhauch@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira
The special byte sequence
0xEF, 0xBF, 0xBF, when parsed as a UTF-8 string, causes theStringCharacterIteratorto returnCharacterIterator.DONEfrom itsnext(),current(), and other similar methods. This caused an infinite loop in theValuesclass whenever that byte sequence was encountered.The fix is pretty simple. To see if we're at the end of a string, we compare
StandardCharacterIterator::getIndextoStandardCharacterIterator::getEndIndex, instead of comparing the last-read character toCharacterIterator.DONE(since that character may occur in strings that we're parsing).I've added a unit test that replicates this bug (when the fix in the
Valuesclass is not present). I gave it a timeout of five seconds in case someone accidentally re-creates the infinite loop in order to save some time and potential confusion.All existing unit tests for the
Valuesclass pass with this change.Committer Checklist (excluded from commit message)