fallintoplace opened a new issue, #1109:
URL: https://github.com/apache/iceberg-go/issues/1109

   `ParseTransform` currently accepts invalid `bucket[...]` and `truncate[...]` 
widths.
   
   For `bucket` and `truncate`, it parses the bracket value with `strconv.Atoi` 
but ignores the error and does not reject zero:
   
   ```go
   n, _ := strconv.Atoi(matches[1])
   ```
   
   Because `regexFromBrackets` accepts digits, inputs like `bucket[0]`, 
`truncate[0]`, and very large values can produce transforms with invalid widths.
   
   That can later panic when the transform is applied. `BucketTransform` takes 
modulo by `int32(t.NumBuckets)`, and integer/decimal truncate paths take modulo 
by the width. A zero width therefore becomes a divide-by-zero panic instead of 
a parse error.
   
   One extra edge case: on 64-bit platforms, a value like `bucket[4294967296]` 
may fit in `int` but becomes `int32(0)` before the bucket modulo. So validation 
should reject values larger than `math.MaxInt32`, not only `Atoi` overflow and 
`<= 0`.
   
   Proposed fix:
   
   - reject `Atoi` errors
   - reject widths `<= 0`
   - reject widths greater than `math.MaxInt32`
   - add parse tests for zero, huge overflow, and int32-overflow widths
   


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