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


##########
processing/src/main/java/org/apache/druid/segment/data/GenericIndexed.java:
##########
@@ -602,6 +618,14 @@ public T get(final int index)
     ByteBuffer bufferedIndexedGetByteBuffer(ByteBuffer copyValueBuffer, int 
startOffset, int endOffset)
     {
       int size = endOffset - startOffset;
+      if (startOffset < Integer.BYTES || endOffset < startOffset || endOffset 
> copyValueBuffer.limit()) {

Review Comment:
   @FrankChen021 Thank you for the thorough catch — you were right. The 
singleThreaded value buffer is reused across calls and its limit narrows to the 
previous value's end, so the check against `copyValueBuffer.limit()` broke 
rightward binary-search probes. Fixed in 9b201971: both V1 and V2 
singleThreaded paths now validate against the original value-region limit 
captured when the view is created (added `bufferLimit` / `valueBufferLimits`), 
and I added `testSingleThreadedRightwardProbes` plus 
`testSingleThreadedSuccessiveLookups`. I verified the new tests reproduce your 
reproducer against the old check (`startOffset[30], endOffset[31], 
limit[21/26]`) and pass with the fix.



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