mardgez13 opened a new issue, #54305:
URL: https://github.com/apache/arrow/issues/54305

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   `parquet::StreamReader` and `parquet::StreamWriter` only support flat 
schemas, but their constructors do not check for it. Both loop over 
`schema->num_columns()` (the number of leaf columns) and take 
`group_node->field(i)` (the i-th field of the root group node), 
`static_pointer_cast`-ing it to `PrimitiveNode`.
   
   When the schema contains a group node:
   - if there are more leaf columns than fields in the root group, `field(i)` 
reads past the end of the root's field vector (ASan reports a 
heap-buffer-overflow in `StreamReader::StreamReader`);
   - otherwise a `GroupNode` is cast to `PrimitiveNode` and later used as one.
   
   For `StreamReader` the schema comes from the file being read, so opening a 
file with a nested schema crashes in the constructor instead of raising 
`ParquetException`.
   
   Expected: both constructors throw `ParquetException` when a field of the 
root group node is not a primitive node.
   
   Seen on main (9f034131).
   
   ### Component(s)
   
   C++, Parquet
   


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