James Server
  1. James Server
  2. JAMES-144

POP3Handler breaks with message numbers out of bounds

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1, 2.1.3, 2.2.0
    • Fix Version/s: 2.2.0
    • Component/s: POP3Server
    • Labels:
      None
    • Environment:
      Operating System: Other
      Platform: All

      Description

      When, for instance,
      LIST 4
      is given as a command when the mailbox contains only two messages, the response
      should be
      -ERR Message (4) does not exist.
      But instead it exits, breaking the connection ungracefully.

      As I see it this is because the code catches ArrayIndexOutOfBoundsException.
      But ArrayList.get() throws IndexOutOfBoundsException.

      It appears that I have fixed this, for the most part, in my working copy by
      changing ArrayIndexOutOfBoundsException to IndexOutOfBoundsException in the
      five places where it occurs in POP3Handler.

      Another problem, not as bad, is shown by the following sequence:
      retr 0
      -ERR Message (0) deleted.

      I think the correct response should be:
      -ERR Message (0) does not exist.

      This would be a little more work to fix, and the problem is not as bad as the
      former.

        Activity

        Hide
        Brill Pappin added a comment -

        I think I've got the same problem, though I haven't been diggin in the code (it just looks tp be the same).

        Some config info:

        • James 2.1.3
        • JDK 1.4.x
        • FreeBSD

        In case this helps, here is the stack trace (address' hidden) from the pop log (the client simply says the service is not accessable):

        17/02/04 20:41:09 INFO pop3server: Connection from ... (...)
        17/02/04 20:41:09 ERROR pop3server: Exception during connection from ... (...) : Index: 1, Size: 1
        java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
        at java.util.ArrayList.RangeCheck(ArrayList.java:507)
        at java.util.ArrayList.get(ArrayList.java:324)
        at org.apache.james.pop3server.POP3Handler.doUIDL(POP3Handler.java:770)
        at org.apache.james.pop3server.POP3Handler.parseCommand(POP3Handler.java:517)
        at org.apache.james.pop3server.POP3Handler.handleConnection(POP3Handler.java:307)
        at org.apache.james.util.connection.ServerConnection$ClientConnectionRunner.run(ServerConnection.java:465)
        at org.apache.james.util.thread.ExecutableRunnable.execute(ExecutableRunnable.java:89)
        at org.apache.james.util.thread.WorkerThread.run(WorkerThread.java:125)

        Show
        Brill Pappin added a comment - I think I've got the same problem, though I haven't been diggin in the code (it just looks tp be the same). Some config info: James 2.1.3 JDK 1.4.x FreeBSD In case this helps, here is the stack trace (address' hidden) from the pop log (the client simply says the service is not accessable): 17/02/04 20:41:09 INFO pop3server: Connection from . . . ( . . . ) 17/02/04 20:41:09 ERROR pop3server: Exception during connection from . . . ( . . . ) : Index: 1, Size: 1 java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at java.util.ArrayList.RangeCheck(ArrayList.java:507) at java.util.ArrayList.get(ArrayList.java:324) at org.apache.james.pop3server.POP3Handler.doUIDL(POP3Handler.java:770) at org.apache.james.pop3server.POP3Handler.parseCommand(POP3Handler.java:517) at org.apache.james.pop3server.POP3Handler.handleConnection(POP3Handler.java:307) at org.apache.james.util.connection.ServerConnection$ClientConnectionRunner.run(ServerConnection.java:465) at org.apache.james.util.thread.ExecutableRunnable.execute(ExecutableRunnable.java:89) at org.apache.james.util.thread.WorkerThread.run(WorkerThread.java:125)
        Hide
        Brill Pappin added a comment -

        Update, this appears to happen when the mail store is empty (0 messages in the mailbox).

        Show
        Brill Pappin added a comment - Update, this appears to happen when the mail store is empty (0 messages in the mailbox).
        Hide
        Noel J. Bergman added a comment -

        This should be fixed in CVS, and the next test build. The wrong exception type was being caught. Also cleared up some of the non-critical text.

        With respect to the response to RETR 0 returning "no such message", "already deleted", or anything else, I tweaked it a bit to clarify, but RFC 1939 section 9 makes it cleaer that the text is purely optional for a human reader. Only the +OK or -ERR are significant.

        Show
        Noel J. Bergman added a comment - This should be fixed in CVS, and the next test build. The wrong exception type was being caught. Also cleared up some of the non-critical text. With respect to the response to RETR 0 returning "no such message", "already deleted", or anything else, I tweaked it a bit to clarify, but RFC 1939 section 9 makes it cleaer that the text is purely optional for a human reader. Only the +OK or -ERR are significant.

          People

          • Assignee:
            Unassigned
            Reporter:
            Rich
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development