Copilot commented on code in PR #3865:
URL: https://github.com/apache/avro/pull/3865#discussion_r3566483031


##########
lang/java/avro/src/main/java/org/apache/avro/SystemLimitException.java:
##########
@@ -294,5 +373,7 @@ static void resetLimits() {
     maxBytesLength = getLimitFromProperty(MAX_BYTES_LENGTH_PROPERTY, 
MAX_ARRAY_VM_LIMIT);
     maxCollectionLength = getLimitFromProperty(MAX_COLLECTION_LENGTH_PROPERTY, 
MAX_ARRAY_VM_LIMIT);
     maxStringLength = getLimitFromProperty(MAX_STRING_LENGTH_PROPERTY, 
MAX_ARRAY_VM_LIMIT);
+    maxCollectionAllocation = 
getLongLimitFromProperty(MAX_COLLECTION_ALLOCATION_PROPERTY,
+        defaultMaxCollectionAllocation());

Review Comment:
   `maxCollectionAllocation` is a long derived from a heap fraction / system 
property, but it isn’t currently bounded by `MAX_ARRAY_VM_LIMIT`. If it’s 
configured (or computed on a very large heap) above the VM limit, zero-byte 
array skips can still loop over more than `Integer.MAX_VALUE - 8` elements 
cumulatively, and the limit becomes inconsistent with the other collection 
caps. Consider clamping `maxCollectionAllocation` to `MAX_ARRAY_VM_LIMIT` when 
refreshing limits.



##########
lang/java/avro/src/main/java/org/apache/avro/SystemLimitException.java:
##########
@@ -35,6 +35,12 @@
  * once single sequence.</li>
  * <li><tt>org.apache.avro.limits.string.maxLength</tt></li> limits the maximum
  * size of <tt>string</tt> types.</li>
+ * <li><tt>org.apache.avro.limits.collectionItems.maxAllocation</tt></li> 
limits
+ * the number of <tt>array</tt> elements whose schema encodes to zero bytes

Review Comment:
   The Javadoc list of limit system properties has malformed <li> markup (each 
item closes </li> immediately after the <tt> tag, then again at the end). Since 
this block was modified, it’d be good to fix the list markup so the generated 
Javadoc renders correctly (and also correct the `bytes` property name while 
touching this section).



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