Github user gemmellr commented on a diff in the pull request:

    https://github.com/apache/qpid-proton-j/pull/20#discussion_r234714952
  
    --- Diff: 
proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBuffer.java
 ---
    @@ -834,22 +834,39 @@ public boolean equals(Object other) {
                 return false;
             }
     
    -        ReadableBuffer buffer = (ReadableBuffer)other;
    -        if (this.remaining() != buffer.remaining()) {
    +        ReadableBuffer buffer = (ReadableBuffer) other;
    +        final int remaining = remaining();
    +        if (remaining != buffer.remaining()) {
                 return false;
             }
    +        if (hasArray()) {
    +            return equals(currentArray, position, remaining, buffer);
    --- End diff --
    
    This bit is a little broken as it uses position without account for any 
array offset in the current buffer. Its position in the buffer may not be the 
same as its position within the array, e.g. if it were previously sliced from a 
larger buffer. Calling equals with slices from two equal buffers with different 
current positions will fail.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to