Skip to content

Enhance sanity check on Parquet metadata #6228

Closed

Description

@jp0317

Describe the bug
It seems the current codes lack sanity checks on metadata, making it vulnerable to corrupted files. The following gives a few example:

  1. There are a bunch of i32 as u32 without checking if the i32 is negative. Unfortunately these u32 may be used to guide buffer allocations (e.g., here) when reading data.

  2. The read_records does not validate the levels_read from read_rep_levels. A corrupted file may cause the read_rep_levels return 0, which could lead to infinite loop,

To Reproduce

Using the read_parquet example to read the two bad files from here. Reading bad-dict-page-header.parquet may give an EOF error but internally the library already has called a Vec::reserve(N) where N is from a negative i32. Reading bad-levels.parquet would simply stuck in infinite loop.

Expected behavior
Examine the metadata and return proper errors

Additional context

Activity

  1. added
    bug
    on Aug 12, 2024
  2. added
    enhancement
    and removed
    bug
    on Aug 12, 2024
  3. alamb commented on Jan 6, 2025

    @alamb
    Contributor

    Given we have merged several relevant PRs I think we should close this ticket. What do you think @jp0317 ?

  4. jp0317 commented on Jan 9, 2025

    @jp0317
    ContributorAuthor

    close this ticket

    sure, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions