You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mime4j-dev@james.apache.org by "Andrey Kolomoets (Created) (JIRA)" <mi...@james.apache.org> on 2011/11/18 23:02:52 UTC

[jira] [Created] (MIME4J-207) Exception while parsing email address with trailing @

Exception while parsing email address with trailing @
-----------------------------------------------------

                 Key: MIME4J-207
                 URL: https://issues.apache.org/jira/browse/MIME4J-207
             Project: JAMES Mime4j
          Issue Type: Bug
          Components: dom
    Affects Versions: 0.7
            Reporter: Andrey Kolomoets
            Priority: Critical


Including this test into org.apache.james.mime4j.field.address.LenientAddressBuilderTest:
...
    public void testParseAddressTrailingAt() throws Exception {
        String s = "<@s...@somehost.com>";
        ByteSequence raw = ContentUtil.encode(s);
        ParserCursor cursor = new ParserCursor(0, s.length());

        Mailbox mailbox = parser.parseMailboxAddress(null, raw, cursor);
        assertEquals("@somehost.com@somehost.com", mailbox.getAddress());
    }

leads to this exception:

java.lang.IndexOutOfBoundsException
	at org.apache.james.mime4j.util.ByteArrayBuffer.byteAt(ByteArrayBuffer.java:107)
	at org.apache.james.mime4j.field.address.LenientAddressBuilder.parseRoute(LenientAddressBuilder.java:103)
	at org.apache.james.mime4j.field.address.LenientAddressBuilder.parseMailboxAddress(LenientAddressBuilder.java:129)
	at org.apache.james.mime4j.field.address.LenientAddressBuilderTest.testParseAddressTrailingAt(LenientAddressBuilderTest.java:107)


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (MIME4J-207) Exception while parsing email address with a leading @

Posted by "Oleg Kalnichevski (Updated) (JIRA)" <mi...@james.apache.org>.
     [ https://issues.apache.org/jira/browse/MIME4J-207?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated MIME4J-207:
-------------------------------------

         Priority: Major  (was: Critical)
    Fix Version/s: 0.7.2
          Summary: Exception while parsing email address with a leading @  (was: Exception while parsing email address with trailing @)
    
> Exception while parsing email address with a leading @
> ------------------------------------------------------
>
>                 Key: MIME4J-207
>                 URL: https://issues.apache.org/jira/browse/MIME4J-207
>             Project: JAMES Mime4j
>          Issue Type: Bug
>          Components: dom
>    Affects Versions: 0.7
>            Reporter: Andrey Kolomoets
>             Fix For: 0.7.2
>
>
> Including this test into org.apache.james.mime4j.field.address.LenientAddressBuilderTest:
> ...
>     public void testParseAddressTrailingAt() throws Exception {
>         String s = "<@s...@somehost.com>";
>         ByteSequence raw = ContentUtil.encode(s);
>         ParserCursor cursor = new ParserCursor(0, s.length());
>         Mailbox mailbox = parser.parseMailboxAddress(null, raw, cursor);
>         assertEquals("@somehost.com@somehost.com", mailbox.getAddress());
>     }
> leads to this exception:
> java.lang.IndexOutOfBoundsException
> 	at org.apache.james.mime4j.util.ByteArrayBuffer.byteAt(ByteArrayBuffer.java:107)
> 	at org.apache.james.mime4j.field.address.LenientAddressBuilder.parseRoute(LenientAddressBuilder.java:103)
> 	at org.apache.james.mime4j.field.address.LenientAddressBuilder.parseMailboxAddress(LenientAddressBuilder.java:129)
> 	at org.apache.james.mime4j.field.address.LenientAddressBuilderTest.testParseAddressTrailingAt(LenientAddressBuilderTest.java:107)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (MIME4J-207) Exception while parsing email address with a leading @

Posted by "Oleg Kalnichevski (Resolved) (JIRA)" <mi...@james.apache.org>.
     [ https://issues.apache.org/jira/browse/MIME4J-207?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved MIME4J-207.
--------------------------------------

    Resolution: Fixed

Per RFC 2822, Section 4.4 [1] the leading portion of an email address that starts with '@' is assumed to be a domain route. So, the address in question is clearly malformed. 

I fixed the bug in the parser code that caused an IndexOutOfBoundsException when parsing such email addresses. However, the result of the parsing operation will be an empty address (blank localpart, null domain) and a domain route consisting of one element (somehost.com@somehost.com).

Oleg

[1] http://www.ietf.org/rfc/rfc2822.txt
                
> Exception while parsing email address with a leading @
> ------------------------------------------------------
>
>                 Key: MIME4J-207
>                 URL: https://issues.apache.org/jira/browse/MIME4J-207
>             Project: JAMES Mime4j
>          Issue Type: Bug
>          Components: dom
>    Affects Versions: 0.7
>            Reporter: Andrey Kolomoets
>             Fix For: 0.7.2
>
>
> Including this test into org.apache.james.mime4j.field.address.LenientAddressBuilderTest:
> ...
>     public void testParseAddressTrailingAt() throws Exception {
>         String s = "<@s...@somehost.com>";
>         ByteSequence raw = ContentUtil.encode(s);
>         ParserCursor cursor = new ParserCursor(0, s.length());
>         Mailbox mailbox = parser.parseMailboxAddress(null, raw, cursor);
>         assertEquals("@somehost.com@somehost.com", mailbox.getAddress());
>     }
> leads to this exception:
> java.lang.IndexOutOfBoundsException
> 	at org.apache.james.mime4j.util.ByteArrayBuffer.byteAt(ByteArrayBuffer.java:107)
> 	at org.apache.james.mime4j.field.address.LenientAddressBuilder.parseRoute(LenientAddressBuilder.java:103)
> 	at org.apache.james.mime4j.field.address.LenientAddressBuilder.parseMailboxAddress(LenientAddressBuilder.java:129)
> 	at org.apache.james.mime4j.field.address.LenientAddressBuilderTest.testParseAddressTrailingAt(LenientAddressBuilderTest.java:107)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira