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 the line protocol scanner to read field keys with quotes correctly #5158

Merged
merged 1 commit into from
Dec 23, 2015

Conversation

jsternberg
Copy link
Contributor

Quotes are not supposed to be significant in field keys, but are
significant in field values. The code as it currently was would
consider quotes in a key to be significant, but the later parser that
would unmarshal the fields from the byte string did not consider those
quotes to be significant. This meant that the following string:

"a=1

The line protocol parser would see a mismatched quote instead of a valid
input to the line protocol. But more nefariously, the following string:

"a=1"=2

The line protocol parser would ignore the first equals since it is
located in the quotation marks and think this was a valid input. It
would then pass it on to the field parser who would panic and die when
it tried to parse 1"=2 as a number.

Fixes #4076.

@jsternberg
Copy link
Contributor Author

@jwilder @pauldix

@jwilder
Copy link
Contributor

jwilder commented Dec 17, 2015

I think changelog needs to be updated. Otherwise, 👍

@jsternberg jsternberg force-pushed the js-4076-line-protocol-parser-panics branch 2 times, most recently from f68af13 to 2ff7ec6 Compare December 18, 2015 14:44
@jsternberg
Copy link
Contributor Author

Updated the changelog and I also decided to add a test from #4076 to verify that it correctly reported an error parsing one of the entires in that ticket.

@jsternberg jsternberg force-pushed the js-4076-line-protocol-parser-panics branch from 2ff7ec6 to f7ce73e Compare December 18, 2015 21:00
Quotes are not supposed to be significant in field keys, but are
significant in field values. The code as it currently was would
consider quotes in a key to be significant, but the later parser that
would unmarshal the fields from the byte string did not consider those
quotes to be significant. This meant that the following string:

    "a=1

The line protocol parser would see a mismatched quote instead of a valid
input to the line protocol. But more nefariously, the following string:

    "a=1"=2

The line protocol parser would ignore the first equals since it is
located in the quotation marks and think this was a valid input. It
would then pass it on to the field parser who would panic and die when
it tried to parse `1"=2` as a number.

Fixes #4076.
@jsternberg jsternberg force-pushed the js-4076-line-protocol-parser-panics branch from f7ce73e to 4813d82 Compare December 23, 2015 14:15
@jwilder
Copy link
Contributor

jwilder commented Dec 23, 2015

👍

1 similar comment
@pauldix
Copy link
Member

pauldix commented Dec 23, 2015

+1

jsternberg added a commit that referenced this pull request Dec 23, 2015
…anics

Fix the line protocol scanner to read field keys with quotes correctly
@jsternberg jsternberg merged commit f00e85d into master Dec 23, 2015
@jsternberg jsternberg deleted the js-4076-line-protocol-parser-panics branch December 23, 2015 16:32
@jwilder jwilder added this to the 0.10.0 milestone Feb 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants