Skip to content

fix: Validate metadata len in IPC reader #8097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

JakeDern
Copy link

@JakeDern JakeDern commented Aug 8, 2025

Which issue does this PR close?

No issue filed.

Rationale for this change

We allocate memory based on metadata length - If an untrusted client writes a meta len of < 0 then we'll allocate a large number of bytes due to sign extension and likely panic.

What changes are included in this PR?

  • Update StreamReader in both places it reads metadata length for < 0 which is at the start of the stream to read the schema, and in the middle of the stream between each message.

Are these changes tested?

Yes, tests for both reads are added

Are there any user-facing changes?

No

@github-actions github-actions bot added the arrow Changes to the arrow crate label Aug 8, 2025
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @JakeDern -- I have a style comment but I think it is stylistic rather than substantitive

cc @viirya and @tustvold for your thoughts

@viirya
Copy link
Member

viirya commented Aug 8, 2025

Why do we need this? I thought that you already include the fix in #8001.

@JakeDern
Copy link
Author

JakeDern commented Aug 8, 2025

@viirya Andrew requested I make a separate fix - The other PR may not make it until the next major release in October as it could have an API change.

JakeDern and others added 4 commits August 8, 2025 11:47
Co-authored-by: Liang-Chi Hsieh <[email protected]>
Co-authored-by: Liang-Chi Hsieh <[email protected]>
Co-authored-by: Liang-Chi Hsieh <[email protected]>
Co-authored-by: Liang-Chi Hsieh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants