ArrayIndexOutOfBoundsException when using OpenJDK with BouncyCastle Provider
Issue
-
When using OpenJDK with EAP, where application has BouncyCastle provider package, the following error was observed in EAP log:
2019-11-01 13:23:14,825 ERROR [CID=] io.undertow.request - UT005023: Exception handling request to /exampleContext/example.js: java.lang.ArrayIndexOutOfBoundsException at java.lang.System.arraycopy(Native Method) at org.bouncycastle.crypto.modes.GCMBlockCipher.doFinal(Unknown Source) at org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher$AEADGenericBlockCipher.doFinal(Unknown Source) at org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher.engineDoFinal(Unknown Source) at javax.crypto.CipherSpi.bufferCrypt(CipherSpi.java:830) at javax.crypto.CipherSpi.engineDoFinal(CipherSpi.java:730) at javax.crypto.Cipher.doFinal(Cipher.java:2459) at sun.security.ssl.CipherBox.encrypt(CipherBox.java:396) at sun.security.ssl.EngineOutputRecord.write(EngineOutputRecord.java:300) at sun.security.ssl.EngineOutputRecord.write(EngineOutputRecord.java:225) at sun.security.ssl.EngineWriter.writeRecord(EngineWriter.java:186) at sun.security.ssl.SSLEngineImpl.writeRecord(SSLEngineImpl.java:1281) at sun.security.ssl.SSLEngineImpl.writeAppRecord(SSLEngineImpl.java:1252) at sun.security.ssl.SSLEngineImpl.wrap(SSLEngineImpl.java:1165) at io.undertow.protocols.ssl.ALPNHackSSLEngine.wrap(ALPNHackSSLEngine.java:153) at io.undertow.server.protocol.http.ALPNLimitingSSLEngine.wrap(ALPNLimitingSSLEngine.java:131) at io.undertow.protocols.ssl.SslConduit.doWrap(SslConduit.java:872) at io.undertow.protocols.ssl.SslConduit.write(SslConduit.java:379) at io.undertow.server.protocol.http.HttpResponseConduit.processWrite(HttpResponseConduit.java:251) at io.undertow.server.protocol.http.HttpResponseConduit.write(HttpResponseConduit.java:598) at io.undertow.conduits.AbstractFixedLengthStreamSinkConduit.write(AbstractFixedLengthStreamSinkConduit.java:106) at io.undertow.conduits.AbstractFixedLengthStreamSinkConduit.write(AbstractFixedLengthStreamSinkConduit.java:120) at org.xnio.conduits.ConduitStreamSinkChannel.write(ConduitStreamSinkChannel.java:158) at io.undertow.channels.DetachableStreamSinkChannel.write(DetachableStreamSinkChannel.java:179) at io.undertow.server.HttpServerExchange$WriteDispatchChannel.write(HttpServerExchange.java:2039) at org.xnio.channels.Channels.writeBlocking(Channels.java:152) at io.undertow.servlet.spec.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:290) at io.undertow.io.BlockingSenderImpl.writeBuffer(BlockingSenderImpl.java:190) at io.undertow.io.BlockingSenderImpl.writeBuffer(BlockingSenderImpl.java:183)
Environment
- Red Hat JBoss Enterprise Application Platform (JBoss EAP)
- 7
- OpenJDK
- 8
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.