diff --git a/rfc5322/address.go b/rfc5322/address.go index e0abeed0..d299fc85 100644 --- a/rfc5322/address.go +++ b/rfc5322/address.go @@ -531,7 +531,8 @@ func isDText(tokenType rfcparser.TokenType) bool { if rfcparser.IsCTL(tokenType) || tokenType == rfcparser.TokenTypeLBracket || tokenType == rfcparser.TokenTypeRBracket || - tokenType == rfcparser.TokenTypeBackslash { + tokenType == rfcparser.TokenTypeBackslash || + tokenType == rfcparser.TokenTypeEOF { return false } diff --git a/rfc5322/parser_test.go b/rfc5322/parser_test.go index 11daa826..324c53cf 100644 --- a/rfc5322/parser_test.go +++ b/rfc5322/parser_test.go @@ -852,3 +852,8 @@ func TestParserAddressEmailValidation(t *testing.T) { }) } } + +func TestParse_GODT_2587_infinite_loop(t *testing.T) { + _, err := ParseAddressList("00@[000000000000000") + assert.Error(t, err) +}