StringIndexOutOfBoundsException on EAP 7 from io.undertow.util.URLUtils.decode

Solution Unverified - Updated -

Issue

  • We see some POST requests fail with the following exception after moving to EAP 7 from EAP 6 or Tomcat:
java.lang.StringIndexOutOfBoundsException: String index out of range: 1
    at java.lang.String.charAt(String.java:658)
    at io.undertow.util.URLUtils.decode(URLUtils.java:132)
    at io.undertow.util.URLUtils.decode(URLUtils.java:78)
    at io.undertow.server.handlers.form.FormEncodedDataDefinition$FormEncodedDataParser.doParse(FormEncodedDataDefinition.java:186)
    at io.undertow.server.handlers.form.FormEncodedDataDefinition$FormEncodedDataParser.parseBlocking(FormEncodedDataDefinition.java:252)
    at io.undertow.servlet.spec.HttpServletRequestImpl.parseFormData(HttpServletRequestImpl.java:832)
    at io.undertow.servlet.spec.HttpServletRequestImpl.getParameterMap(HttpServletRequestImpl.java:785)
  • This behavior can be observed with GET request.
ERROR [io.undertow.request] (newWorker I/O-14) UT005001: An exception occurred processing the request: java.lang.StringIndexOutOfBoundsException: String index out of range: 43
    at java.lang.String.charAt(String.java:658)
    at io.undertow.util.URLUtils.decode(URLUtils.java:115)
    at io.undertow.util.URLUtils$QueryStringParser.decode(URLUtils.java:258)
    at io.undertow.util.URLUtils$QueryStringParser.parse(URLUtils.java:241)
    at io.undertow.util.URLUtils.parseQueryString(URLUtils.java:53)
    at io.undertow.server.protocol.ajp.AjpRequestParser.parse(AjpRequestParser.java:418)
    at io.undertow.server.protocol.ajp.AjpReadListener.handleEvent(AjpReadListener.java:169)
    at io.undertow.server.protocol.ajp.AjpOpenListener.handleEvent(AjpOpenListener.java:131)
    at io.undertow.server.protocol.ajp.AjpOpenListener.handleEvent(AjpOpenListener.java:51)
    at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
    at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:291)
    at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:286)
    at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
    at org.xnio.nio.QueuedNioTcpServer$1.run(QueuedNioTcpServer.java:131)
    at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:592)
    at org.xnio.nio.WorkerThread.run(WorkerThread.java:472)

Environment

  • JBoss Enterprise Application Platform (EAP) 7.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In