nssalian opened a new pull request, #16568:
URL: https://github.com/apache/iceberg/pull/16568

   Closes [#16334](https://github.com/apache/iceberg/issues/16334)
   Addresses [#16455](https://github.com/apache/iceberg/issues/16455)
   
   ## Summary
   
   Validates malformed Variant binary input so adversarial buffers fail fast 
with `IllegalArgumentException` instead of OOM, `StackOverflowError`, or raw 
JVM exceptions. Adds bounds checks across header, count, offset table,
   primitive payload, and short-string length, plus a 500-level nesting depth 
cap threaded through object/array recursive descent.
   
   The approach mirrors Steve Loughran's parquet-java hardening work in 
[apache/parquet-java#3562](https://github.com/apache/parquet-java/pull/3562). 
Pulled in the changes from @steveloughran's 
[#16335](https://github.com/apache/iceberg/pull/16335) 
   
   ## Changes
   
   - `SerializedMetadata`, `SerializedArray`, `SerializedObject`: header / 
count / offset-table bounds, lazy per-element offset and field-id checks, long 
arithmetic to prevent int overflow.
   - `SerializedPrimitive`: payload bounds, BIN/STR size-field bounds, 
non-negative size.
   - `SerializedShortString`: length bounds.
   - `VariantUtil`: `MAX_VARIANT_DEPTH = 500` and `fromBuffer` dispatch 
threading depth through recursive descent.
   - `TestMalformedVariant`: 20 attack-payload tests covering each new check.
   
   ## Test plan
   
   - [x] `./gradlew :iceberg-api:test --tests 'org.apache.iceberg.variants.*'`


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