Ariel Weisberg created CASSANDRA-9241:
-----------------------------------------

             Summary: ByteBuffer.array() without ByteBuffer.arrayOffset() + 
ByteBuffer.position() is a bug
                 Key: CASSANDRA-9241
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-9241
             Project: Cassandra
          Issue Type: Bug
            Reporter: Ariel Weisberg
            Assignee: Ariel Weisberg
             Fix For: 3.0


I found one instance of this on OHCProvider so it make sense to review all 
usages since there aren't that many.

Some suspect things:
https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/utils/FastByteOperations.java#L197
https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java#L1877
https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/gms/TokenSerializer.java#L40
https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/io/compress/CompressedRandomAccessReader.java#L178
https://github.com/apache/cassandra/blob/trunk/tools/stress/src/org/apache/cassandra/stress/operations/predefined/CqlOperation.java#L104
https://github.com/apache/cassandra/blob/trunk/tools/stress/src/org/apache/cassandra/stress/operations/predefined/CqlOperation.java#L543
https://github.com/apache/cassandra/blob/trunk/tools/stress/src/org/apache/cassandra/stress/operations/predefined/CqlOperation.java#L563

I made this list off of 8099 so I might have missed some instances on trunk. 
FastByteOperations makes me cross eyed so it is worth a second pass to make 
sure offsets in byte buffers are handled correctly.

Generally I like to use the full incantation even when I have done things like 
allocate the buffer on the stack locally for copy pasta/refactoring reasons and 
to make clear to new users how the API is supposed to work.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to