You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Benoit Tellier (Jira)" <se...@james.apache.org> on 2021/09/04 06:10:00 UTC
[jira] [Commented] (JAMES-2278) IMAP QRESYNC (RFC-5162) is buggy
[ https://issues.apache.org/jira/browse/JAMES-2278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17409856#comment-17409856 ]
Benoit Tellier commented on JAMES-2278:
---------------------------------------
I think this PR would deserve to be rebased and proposed to recent James versions.
(I'm happy to have had done archeology I had been looking for this one a few weeks ago!)
> IMAP QRESYNC (RFC-5162) is buggy
> --------------------------------
>
> Key: JAMES-2278
> URL: https://issues.apache.org/jira/browse/JAMES-2278
> Project: James Server
> Issue Type: Bug
> Components: IMAPServer
> Affects Versions: 3.0.0, master, 3.0.1
> Reporter: Benoit Tellier
> Priority: Major
> Labels: bugfix
>
> As reported by lmilev on the gitter chat, passing known sequence sets to QRESYNC leads to an error in the IMAP layer:
> {code:java}
> INFO | jvm 1 | 2018/01/03 12:25:15 | [imapserver-executor-17] ERROR org.apache.james.imap.processor.base.AbstractChainedProcessor - Error while processing IMAP request
> INFO | jvm 1 | 2018/01/03 12:25:15 | java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
> INFO | jvm 1 | 2018/01/03 12:25:15 | at java.util.ArrayList.rangeCheck(ArrayList.java:653)
> INFO | jvm 1 | 2018/01/03 12:25:15 | at java.util.ArrayList.get(ArrayList.java:429)
> INFO | jvm 1 | 2018/01/03 12:25:15 | at org.apache.james.imap.processor.AbstractSelectionProcessor.respond(AbstractSelectionProcessor.java:240)
> INFO | jvm 1 | 2018/01/03 12:25:15 | at org.apache.james.imapserver.netty.ImapChannelUpstreamHandler.messageReceived(ImapChannelUpstreamHandler.java:194)
> {code}
> I tried to write a MPT test but it is not trivial as it depends on random values (UIDVALIDITY) and non fixed values (MODSEQ). Moreover the code is messy, dirty and not explicit.
> The incriminated lines seems to be:
> {code:java}
> if (knownUidsList.size() > index++) {
> int msnAsInt = msn.intValue();
> MessageUid knownUid = knownUidsList.get(index);
> // Complicated sequential stuff
> }
> {code}
> As this little test shows it:
> {code:java}
> @Test
> public void test() {
> int i = 0;
> System.out.println(i++);
> System.out.println(i++);
> }
> // Will output
> // 0
> // 1
> {code}
> The index can clearly be out of range.
> {code:java}
> if (knownUidsList.size() > ++index) {
> int msnAsInt = msn.intValue();
> MessageUid knownUid = knownUidsList.get(index);
> // Complicated sequential stuff
> }
> {code}
> Should fix the issue.
> We should find a way to provide *at least* unit tests for that issue.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org