Some unicode pattern in status message can break the session connection
Description
Environment
is related to
Activity
Florian Schmaus May 6, 2014 at 2:07 PM
We decided to forbid users to create new issues. As stated at http://issues.igniterealtime.org/browse/OF, you should simply post a bug report in the appropriate forum (Openfire Dev). The more detailed the bug report is, the higher the chances that the issue is fixed soon.
Robert Robert May 6, 2014 at 1:53 PM
Well, both actually. Daryl was able to file a new ticket for this new issue, but there is another one directly related to the fix for this issue as far as I can tell. That issue is that attempts to log these characters now generate errors almost nonstop:
2014.05.05 22:15:40 org.jivesoftware.openfire.muc.spi.MUCPersistenceManager - Er
ror saving conversation log entry
java.sql.SQLException: Incorrect string value: '\xF0\x9F\x92\x94' for column 'bo
dy' at row 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1084)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4232)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4164)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2838)
But the other issue is indeed a new issue that was added with the new version. I had to comment about it here because I apparently can't create new issues.
Florian Schmaus May 6, 2014 at 1:45 PM
@Robert Chady: I am assuming you meant with "at the expense of a couple other errors" that the new openfire version fixes this for you but introduces another bug(s), and not that the fix for this issue is introducing a new bug. Correct?
Daryl Herzmann May 6, 2014 at 12:59 PMEdited
@Robert Chady, I can reproduce as well Opened https://igniterealtime.atlassian.net/browse/OF-791#icft=OF-791
Robert Robert May 6, 2014 at 12:54 PM
This does indeed seem to be working now, but at the expense of a couple other errors it seems. The largest is, after I upgraded to 3.9.2, anyone attempting to join a MUC that was not created on the server gets a 404 error. I had to recreate every MUC by hand via the console just to get them working.
Unfortunately, I apparently can't create a new issue to report this so I'm mentioning it here. Hopefully someone will see this and create an issue for this.
I am not using embedded-db. I am using a mysql backend when this error occurs.
I have narrowed it down. It IS NOT every unicode message that causes this error. It is a very specific sequence of characters. I have narrowed it down to the following presence packet/status that will cause the problem:
login
DO NOT send the initial roster request.
send the packet with the status update (replace username and password as appropriate). The name payload is:
'\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x8 7\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe 8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xa a\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x8 7\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe 8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xa a\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x8 7\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe 8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa\xe8\x87\xaa'
<iq type="set" id="3">
<query xmlns="jabber:iq:register">
<username>XXX</username>
<password>XXX</password>
<name>自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自自</name>
</query>
</iq>
This will cause openfire to error and close the connection with the following in the warn.log:
2011.04.27 18:58:41 Closing session due to exception: (SOCKET, R: /127.0.0.1:64330, L: /127.0.0.1:5222, S: 0.0.0.0/0.0.0.0:5222)
org.apache.mina.filter.codec.ProtocolDecoderException: java.nio.charset.MalformedInputException: Input length = 2 (Hexdump: 3C 69 71 20 74 79 70 65 3D 22 73 65 74 22 20 69 64 3D 22 33 22 3E 3C 71 75 65 72 79 20 78 6D 6C 6E 73 3D 22 6A 61 62 62 65 72 3A 69 71 3A 72 65 67 69 73 74 65 72 22 3E 3C 75 73 65 72 6E 61 6D 65 3E 74 65 73 74 31 3C 2F 75 73 65 72 6E 61 6D 65 3E 3C 70 61 73 73 77 6F 72 64 3E 6A 40 62 62 33 72 73 74 31 67 3C 2F 70 61 73 73 77 6F 72 64 3E 3C 6E 61 6D 65 3E E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87)
at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecF ilter.java:170)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(Ab stractIoFilterChain.java:299)
at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilt erChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceive d(AbstractIoFilterChain.java:648)
at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java :239)
at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(Execut orFilter.java:283)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java: 651)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
at java.lang.Thread.run(Thread.java:613)
Caused by: java.nio.charset.MalformedInputException: Input length = 2
at java.nio.charset.CoderResult.throwException(CoderResult.java:260)
at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:771)
at org.jivesoftware.openfire.nio.XMLLightweightParser.read(XMLLightweightParser.ja va:183)
at org.jivesoftware.openfire.nio.XMPPDecoder.doDecode(XMPPDecoder.java:41)
at org.apache.mina.filter.codec.CumulativeProtocolDecoder.decode(CumulativeProtoco lDecoder.java:133)
at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecF ilter.java:163)
... 9 more
2011.04.27 18:58:41 Closing session due to exception: (SOCKET, R: /127.0.0.1:64330, L: /127.0.0.1:5222, S: 0.0.0.0/0.0.0.0:5222)
org.apache.mina.filter.codec.ProtocolDecoderException: java.nio.charset.MalformedInputException: Input length = 1 (Hexdump: AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA E8 87 AA 3C 2F 6E 61 6D 65 3E 3C 2F 71 75 65 72 79 3E 3C 2F 69 71 3E)
at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecF ilter.java:170)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(Ab stractIoFilterChain.java:299)
at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilt erChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceive d(AbstractIoFilterChain.java:648)
at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java :239)
at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(Execut orFilter.java:283)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java: 651)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
at java.lang.Thread.run(Thread.java:613)
Caused by: java.nio.charset.MalformedInputException: Input length = 1
at java.nio.charset.CoderResult.throwException(CoderResult.java:260)
at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:771)
at org.jivesoftware.openfire.nio.XMLLightweightParser.read(XMLLightweightParser.ja va:183)
at org.jivesoftware.openfire.nio.XMPPDecoder.doDecode(XMPPDecoder.java:41)
at org.apache.mina.filter.codec.CumulativeProtocolDecoder.decode(CumulativeProtoco lDecoder.java:133)
at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecF ilter.java:163)
... 9 more