BufferOverflow possible on an unwrap
If my outgoiing buffer is the size the SSLSession tells me to make it and the incoming buffer is the size it tells me to make it, is it possible to get a BufferOverflow? Shouldn't the sizes be enough that this will never happen as long as the outgoing buffer is cleared. According to my logs, it looks like I have an empy out buffer, and I have a loop which decrypted some of the data in the incoming buffer(not all), and then it tries to decrypt more but can't due to BufferOverflow which makes no sense to me as the Buffer has plenty of room left. Here is the logs. Notice I log the buffers before in the loop and after unwrap is called.
INFO: [echoServer][session 0]
incoming=java.nio.HeapByteBuffer[pos=0 lim=4995 cap=16665]
out=java.nio.HeapByteBuffer[pos=0 lim=16384 cap=16384]
Aug 2, 2005 6:52:12 AM biz.xsoftware.impl.nio.cm.basic.Helper processKeys
WARNING: [echoServer] unwrap failed
java.lang.RuntimeException: Bug, stuck in loop,
bufIn=java.nio.HeapByteBuffer[pos=37 lim=4995 cap=16665]
bufOut=java.nio.HeapByteBuffer[pos=5 lim=16384 cap=16384] hsStatus=NOT_HANDSHAKING status=BUFFER_OVERFLOW
at biz.xsoftware.impl.nio.secure.engine.AsynchSSLEngineImpl.feedEncryptedPacketImpl(AsynchSSLEngineImpl.java:193)
at biz.xsoftware.impl.nio.secure.engine.AsynchSSLEngineImpl.feedEncryptedPacket(AsynchSSLEngineImpl.java:144)
at biz.xsoftware.impl.nio.secure.engine.AsynchSSLEngineSynchronized.feedEncryptedPacket(AsynchSSLEngineSynchronized.java:32)
at biz.xsoftware.impl.nio.cm.secure.ReaderProxy.incomingData(ReaderProxy.java:33)
at biz.xsoftware.impl.nio.cm.basic.Helper.read(Helper.java:146)
at biz.xsoftware.impl.nio.cm.basic.Helper.processKey(Helper.java:77)
at biz.xsoftware.impl.nio.cm.basic.Helper.processKeys(Helper.java:43)
at biz.xsoftware.impl.nio.cm.basic.SelectorManager2.runLoop(SelectorManager2.java:259)
at biz.xsoftware.impl.nio.cm.basic.SelectorManager2$PollingThread.run(SelectorManager2.java:222)

