Bound ParserCursor by byte length in LenientAddressParser CharSequence overloads (#129)
CharSequence overloads in LenientAddressParser use text.length() (not encoded) as input length for cursor. Cursor uses raw (encoded) as input. So it operates on raw input (encoded) but uses text’s length (not encoded). This creates a mismatch when inputting text with non ascii chars. The result is that raw.length() - text.length() bytes are cut off at the end. Example: parseAddressList(“Grüße hans.mueller@acme.org“) -> hans.mueller@acme.or The existing test LenientAddressBuilderTest::testParseMailboxNonASCII did not catch that because it only contains a single 2-byte non ascii char, so only one byte is cut off: ‘>’ which is tolerated by the parser. LenientAddressParser::parseMailbox already implements this in a correct manner.
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号