github-advanced-security[bot] commented on code in PR #16389:
URL: https://github.com/apache/druid/pull/16389#discussion_r1589860282


##########
processing/src/main/java/org/apache/druid/segment/data/ImmutableRTreeObjectStrategy.java:
##########
@@ -63,8 +63,10 @@
   @Override
   public ImmutableRTree fromByteBuffer(ByteBuffer buffer, int numBytes)
   {
-    buffer.limit(buffer.position() + numBytes);
-    return new ImmutableRTree(buffer, bitmapFactory);
+    // always create the duplicate buffer for creating the objects as original 
buffer may have mutations somewhere else which can corrupt objects
+    ByteBuffer duplicateBuf = buffer.duplicate();
+    duplicateBuf.limit(duplicateBuf.position() + numBytes);

Review Comment:
   ## User-controlled data in arithmetic expression
   
   This arithmetic expression depends on a [user-provided value](1), 
potentially causing an overflow.
   This arithmetic expression depends on a [user-provided value](2), 
potentially causing an overflow.
   This arithmetic expression depends on a [user-provided value](3), 
potentially causing an overflow.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/7331)



-- 
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