TastyHeadphones opened a new pull request, #11955:
URL: https://github.com/apache/arrow-rs/pull/11955

   # Which issue does this PR close?
   
   - Closes #11954.
   
   # Rationale for this change
   
   `schema_from_array_helper` calls `Vec::with_capacity` with 
`SchemaElement.num_children` straight from the footer. A corrupt footer that 
claims about 2^31 children makes the reader abort on a failed allocation 
instead of returning an error.
   
   The other case in the issue, the row-group list count in 
`parquet_metadata_from_bytes`, is already bounded on `main` by 
`check_list_size` (covered by 
`row_group_count_exceeding_remaining_input_is_rejected`), so this PR only 
handles `num_children`.
   
   # What changes are included in this PR?
   
   Each child uses at least one schema element, so a group whose `num_children` 
is larger than the number of elements left after it now returns a 
`ParquetError` before anything is reserved.
   
   # Are these changes tested?
   
   Yes. 
`test_parquet_schema_from_array_rejects_num_children_exceeding_remaining` 
covers a root that claims `i32::MAX` children with nothing after it, and a root 
that claims 2 children with only 1 element after it.
   
   # Are there any user-facing changes?
   
   No API changes. Corrupt footers with an impossible `num_children` now return 
an error instead of aborting.
   
   This change was drafted with AI assistance (Grok) and reviewed and tested by 
me.
   


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