Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1150

Hpack ArrayOutOfBound exception when client sends invalid index

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 2.0.0.Beta1, 1.4.19.Final
    • None
    • None
    • None

    Description

      With current HTTP2 implementation in Undertow, we get following ArrayIndexOutOfBoundsException when running third-party h2spec testsuite:

      20:32:14,723 ERROR [io.undertow] (default task-13) UT005085: Connection io.undertow.server.protocol.http2.Http2ServerConnection@4214cd96 for exchange HttpServerExchange{ GET / request {Host=[localhost:8443]} response {Last-Modified=[Sat, 29 Jul 2017 02:38:24 GMT], X-Powered-By=[Undertow/1], Server=[JBoss-EAP/7], Content-Length=[1517], Content-Type=[text/html], Accept-Ranges=[bytes], Date=[Tue, 08 Aug 2017 18:32:14 GMT], :status=[200]}} was not closed cleanly, forcibly closing connection
      20:32:16,463 ERROR [org.xnio.listener] (default I/O-8) XNIO001007: A channel event listener threw an exception: java.lang.ArrayIndexOutOfBoundsException: -8
      	at io.undertow.protocols.http2.HpackDecoder.handleIndex(HpackDecoder.java:293)
      	at io.undertow.protocols.http2.HpackDecoder.decode(HpackDecoder.java:113)
      	at io.undertow.protocols.http2.Http2HeaderBlockParser.handleData(Http2HeaderBlockParser.java:110)
      	at io.undertow.protocols.http2.Http2PushBackParser.parse(Http2PushBackParser.java:62)
      	at io.undertow.protocols.http2.Http2FrameHeaderParser.handle(Http2FrameHeaderParser.java:172)
      	at io.undertow.protocols.http2.Http2Channel.parseFrame(Http2Channel.java:539)
      	at io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:427)
      	at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:108)
      	at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:59)
      	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
      	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:932)
      	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:913)
      	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
      	at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
      	at io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1131)
      	at io.undertow.protocols.ssl.SslConduit$1.run(SslConduit.java:168)
      	at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:592)
      	at org.xnio.nio.WorkerThread.run(WorkerThread.java:472)
      

      Problem is caused by this test:

      HPACK: Header Compression for HTTP/2
        2. Compression Process Overview
          2.3. Indexing Tables
            2.3.3. Index Address Space
              ✔ 1: Sends a header field representation with invalid index
      

      Good thing is that EAP behaves as expected - thus this tests passes. This whole situation is a result of badly behaving HTTP/2 client that talks to EAP. Although, I think that we should avoid such exception and rather print some reasonable log message instead.

      Attachments

        Issue Links

          Activity

            People

              sdouglas1@redhat.com Stuart Douglas
              sdouglas1@redhat.com Stuart Douglas
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: