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

Lexer hangs when trying to parse 'a = /b' or 'a = !b', etc. #76

Closed
lmb opened this issue Jun 30, 2016 · 2 comments
Closed

Lexer hangs when trying to parse 'a = /b' or 'a = !b', etc. #76

lmb opened this issue Jun 30, 2016 · 2 comments
Labels
bug Issues describing a bug in go-toml.

Comments

@lmb
Copy link
Contributor

lmb commented Jun 30, 2016

Given the following test case

diff --git a/parser_test.go b/parser_test.go
index 1ea5924..09d552b 100644
--- a/parser_test.go
+++ b/parser_test.go
@@ -299,6 +299,13 @@ func TestArrayNestedStrings(t *testing.T) {
    })
 }

+func TestUnescapedString(t *testing.T) {
+   _, err := Load("a = !bssss")
+   if err == nil {
+       t.Error("Expecting a parse error")
+   }
+}
+
 func TestMissingValue(t *testing.T) {
    _, err := Load("a = ")
    if err.Error() != "(1, 5): expecting a value" {

I originally though the problem is the lexer blocking to read more runes, but it seems like the whole lexRvalue gets into an infinite loop.

@pelletier
Copy link
Owner

Thanks for the report! Will look into that.

@pelletier pelletier added the bug Issues describing a bug in go-toml. label Jun 30, 2016
pelletier added a commit that referenced this issue Jun 30, 2016
pelletier added a commit that referenced this issue Jun 30, 2016
@pelletier
Copy link
Owner

The lexer didn't have a catch-all rule when lexing an rvalue, causing it to loop indefinitely. Should be all fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues describing a bug in go-toml.
Projects
None yet
Development

No branches or pull requests

2 participants