wgtmac opened a new pull request, #1023:
URL: https://github.com/apache/iceberg-cpp/pull/1023

   ## Summary
   
   Follow-up to #961. That PR rejected oversized inputs inside 
`BucketUtils::HashBytes`, but to cover the guard with a test it also added an 
internal `HashBytes(const uint8_t*, size_t)` overload plus 
`bucket_util_internal.h`, and the regression test needed a pointer/length pair 
because a `std::span` covering more elements than the object provides is 
undefined behavior ([span.cons]).
   
   This PR removes that scaffolding and enforces the limit at the `Result` 
boundary instead:
   
   - `BucketIndex` checks the byte length of string, binary, and fixed literals 
before hashing and returns `InvalidArgument`, so the `Result`-returning entry 
point never throws. Its documentation no longer claims otherwise.
   - `BucketUtils::HashBytes` keeps rejecting inputs above `INT32_MAX` with 
`IcebergError` and keeps documenting that throw; it remains the defensive 
barrier for direct callers.
   - `bucket_util_internal.h`, the internal overload, and 
`HashBytesRejectsOversizedInput` are removed.
   
   The bound is unchanged: `INT32_MAX` is what iceberg-java can express, since 
Java hashes int-indexed `byte[]` values, so no legal bucket input is rejected.
   
   On test coverage: reaching the guard requires either a 2 GiB allocation or 
an invalid `std::span`, so the behavior is covered by review and CI rather than 
by a fabricated input. Deleted tests: 1.
   
   ## Test plan
   
   - [x] `util_test` (379 tests, 44 suites) passes on this head.
   - [x] `bucket_util.cc` and `bucket_util_test.cc` compile with warnings as 
errors.
   


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