Skip to content

parquet: decode_metadata reserves memory from unvalidated footer counts (row groups, num_children) #11954

Closed

Description

@kandarpck

Describe the bug

ParquetMetaDataReader::decode_metadata reserves capacity from two counts read from the footer before checking that the input can hold them. A corrupt footer that claims about 2^31 entries makes the process abort on a failed allocation instead of returning an error.

  1. Row groups, file/metadata/thrift/mod.rs (59.3.1, line 815):
    Vec::with_capacity(list_ident.size as usize). read_thrift_vec already guards the same pattern ("Thrift list size {} exceeds remaining input length {}", parquet_thrift.rs:739), but this call site does not.
  2. SchemaElement.num_children, schema/types.rs (59.3.1, line 1403):
    Vec::with_capacity(usize::try_from(n)?), where n is not bounded by the number of schema elements.

Also present in 59.3.2.

To Reproduce

For case 1, decode this 17-byte FileMetaData (Thrift compact): version 1, a one-element schema, num_rows 0, then row_groups as a list header claiming 2147483647 structs:
15 02 19 1C 48 01 72 00 16 00 19 FC FF FF FF FF 07
ParquetMetaDataReader::decode_metadata(&bytes) asks for about 206 GB and the process aborts.

Expected behavior

An Err(ParquetError) in both cases: bound the row-group count by prot.remaining_bytes() as read_thrift_vec does, and reject num_children greater than the number of schema elements.

Additional context

While decoding footers received from another process - one bad footer causes the reader to crash

Activity

  1. added
    bug
    on Oct 28, 2026
  2. added theissue type on Oct 28, 2026
  3. huong8373tt-beep commented on Nov 1, 2026

    @huong8373tt-beep

    take

  4. etseidl commented on Nov 2, 2026

    @etseidl
    Contributor

    This issue is irresistible honey for AI bots. I'm taking ownership defensively. I'll address it in due time. Happy to bump priority if this is an actual problem in a real workflow.

  5. added a commit that references this issue on Nov 13, 2026
    df096d7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions