diff --git a/conf/lex.go b/conf/lex.go index 49ca743a..390ef734 100644 --- a/conf/lex.go +++ b/conf/lex.go @@ -413,6 +413,8 @@ func lexIncludeQuotedString(lx *lexer) stateFn { lx.next() lx.ignore() return lx.pop() + case r == eof: + return lx.errorf("Unexpected EOF in quoted include") } return lexIncludeQuotedString } @@ -429,6 +431,8 @@ func lexIncludeDubQuotedString(lx *lexer) stateFn { lx.next() lx.ignore() return lx.pop() + case r == eof: + return lx.errorf("Unexpected EOF in double quoted include") } return lexIncludeDubQuotedString } diff --git a/conf/parse_test.go b/conf/parse_test.go index 427aeba1..37d533fc 100644 --- a/conf/parse_test.go +++ b/conf/parse_test.go @@ -385,9 +385,11 @@ func TestIncludeVariablesWithChecks(t *testing.T) { } func TestParserNoInfiniteLoop(t *testing.T) { - if _, err := Parse(`A@@Føøøø?˛ø:{øøøø˙˙`); err == nil { - t.Fatal("expected an error") - } else if !strings.Contains(err.Error(), "Unexpected EOF") { - t.Fatal("expected unexpected eof error") + for _, test := range []string{`A@@Føøøø?˛ø:{øøøø˙˙`, `include "9/�`} { + if _, err := Parse(test); err == nil { + t.Fatal("expected an error") + } else if !strings.Contains(err.Error(), "Unexpected EOF") { + t.Fatal("expected unexpected eof error") + } } }