zhongyujiang commented on code in PR #8840:
URL: https://github.com/apache/paimon/pull/8840#discussion_r3654173989


##########
paimon-common/src/main/java/org/apache/paimon/data/serializer/BinaryRowSerializer.java:
##########
@@ -261,9 +261,26 @@ private void pointToMultiSegments(
      * binary row fixed part. See {@link BinaryRow}.
      */
     private int checkSkipWriteForFixLengthPart(AbstractPagedOutputView out) 
throws IOException {
+        // The fixed-length part of a BinaryRow must reside within a single 
memory segment,
+        // because random field access (e.g. getLong/getString) always reads 
from segments[0]
+        // without bounds checking. If it is larger than the page size, 
advancing to the next
+        // segment cannot help and the row would silently span segments, 
leading to corrupted
+        // field offsets and eventually a NegativeArraySizeException. Fail 
fast instead.
+        int fixedPartLength = getSerializedRowFixedPartLength();
+        int segmentSize = out.getSegmentSize();
+        checkArgument(

Review Comment:
   Updated.



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

Reply via email to