Uploaded image for project: 'QuickFIX/J'
  1. QuickFIX/J
  2. QFJ-376

When a lot of bad data is pumped into the QF/J, it does nothing

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Default
    • Resolution: Fixed
    • Affects Version/s: 1.3.3
    • Fix Version/s: 1.4.0
    • Component/s: None
    • Labels:
      None

      Description

      Setup: QuickFix/J acceptor listening on a port.

      Test case: connect to the port on which the acceptor is listening via telnet and pump the data from /dev/zero (telnet HOST PORT < /dev/zero & )

      What happens?
      The server is DOS'ed into an eventual OutOfMemoryError

      Why?
      In MINA,
      org.apache.mina.filter.codec.CumulativeProtocolDecoder.decode() accumulates the data in a session buffer until it is processed.
      org.apache.mina.filter.codec.demux.DemuxingProtocolCodecFactory.ProtocolDecoderImpl.doDecode() is called to process the data.
      It calls org.apache.mina.filter.codec.demux.MessageDecoder.decodable() method to identify which protocol to use.

      In QuickFix/J,
      quickfix.mina.message.FIXMessageDecoder.decodable() keeps iterating over and over again over ever increasing ByteBuffer, and keeps returning MessageDecoderResult.NEED_DATA.

      What I think should be done to fix it:
      quickfix.mina.message.FIXMessageDecoder.decodable() should instead return MessageDecoderResult.NOT_OK after the length of the unprocessed data grows beyond certain reasonable length comparable with the HEADER_PATTERN's potential max length. This would cause MINA to throw ProtocolDecoderException and the connection to be shut down.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              alexrat aleksey ratushnyy
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: