dcapwell commented on code in PR #2122:
URL: https://github.com/apache/cassandra/pull/2122#discussion_r1114799706


##########
src/java/org/apache/cassandra/transport/CBUtil.java:
##########
@@ -478,7 +487,37 @@ public static void writeValue(ByteBuffer bytes, ByteBuf cb)
         cb.writeInt(remaining);
 
         if (remaining > 0)
-            cb.writeBytes(bytes.duplicate());
+        {
+            cb.writeBytes(MemoryUtil.duplicateHeapByteBuffer(bytes, 
getLocalBuffer()));
+        }
+    }
+
+    public static void writeValue(ByteBuffer src, ByteBuf dest)
+    {
+        if (src == null)
+        {
+            dest.writeInt(-1);
+            return;
+        }
+
+        int length = src.remaining();
+        dest.writeInt(length);
+
+        if (src.hasArray())
+        {
+            byte[] array = src.array();

Review Comment:
   can you flesh this out more?  Scott showed you the bug.
   
   it is also not an "improper" way, it was a bug in CMS



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to