FrankChen021 commented on code in PR #20447:
URL: https://github.com/apache/druid/pull/20447#discussion_r4237678066


##########
processing/src/main/java/org/apache/druid/segment/data/GenericIndexed.java:
##########
@@ -599,9 +633,17 @@ public T get(final int index)
     }
 
     @Nullable
-    ByteBuffer bufferedIndexedGetByteBuffer(ByteBuffer copyValueBuffer, int 
startOffset, int endOffset)
+    ByteBuffer bufferedIndexedGetByteBuffer(ByteBuffer copyValueBuffer, int 
startOffset, int endOffset, int bufferLimit)
     {
       int size = endOffset - startOffset;
+      if (startOffset < Integer.BYTES || endOffset < startOffset || endOffset 
> bufferLimit) {

Review Comment:
   [P2] Restore the reusable limit before marker lookup
   
   **Finding:** This check uses the stable original limit, but the null/empty 
marker read still uses copyValueBuffer's current limit, which may have been 
narrowed by an earlier direct getByteBuffer call. A later in-range zero-length 
value can therefore throw IndexOutOfBoundsException instead of being returned 
or rejected descriptively.
   
   **Suggestion:** Read the marker through a view restored to bufferLimit 
before checking it, and add a successive lookup regression for null or empty 
values.



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