PROTON-714: don't overflow the input buffer

git-svn-id: https://svn.apache.org/repos/asf/qpid/proton/trunk@1632004 
13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/e843420a
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/e843420a
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/e843420a

Branch: refs/heads/examples
Commit: e843420acf266a836b965683129cd8693df3d796
Parents: 7c9abd0
Author: Rafael H. Schloming <[email protected]>
Authored: Wed Oct 15 12:45:47 2014 +0000
Committer: Rafael H. Schloming <[email protected]>
Committed: Wed Oct 15 12:45:47 2014 +0000

----------------------------------------------------------------------
 .../qpid/proton/engine/impl/ssl/SimpleSslTransportWrapper.java | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e843420a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ssl/SimpleSslTransportWrapper.java
----------------------------------------------------------------------
diff --git 
a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ssl/SimpleSslTransportWrapper.java
 
b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ssl/SimpleSslTransportWrapper.java
index 2599290..a25ea46 100644
--- 
a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ssl/SimpleSslTransportWrapper.java
+++ 
b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ssl/SimpleSslTransportWrapper.java
@@ -125,7 +125,13 @@ public class SimpleSslTransportWrapper implements 
SslTransportWrapper
             } else {
                 ByteBuffer tail = _underlyingInput.tail();
                 _decodedInputBuffer.flip();
+                int limit = _decodedInputBuffer.limit();
+                int overflow = _decodedInputBuffer.remaining() - capacity;
+                if (overflow > 0) {
+                    _decodedInputBuffer.limit(limit - overflow);
+                }
                 tail.put(_decodedInputBuffer);
+                _decodedInputBuffer.limit(limit);
                 _decodedInputBuffer.compact();
                 _underlyingInput.process();
                 capacity = _underlyingInput.capacity();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to