Skip to content

GH-55400: [C++][IPC] Validate ReadMessage body_length - #55382

Open
professor-moody wants to merge 1 commit into
apache:mainfrom
professor-moody:fix-ipc-readmessage-body-length
Open

professor-moody wants to merge 1 commit into
apache:mainfrom
professor-moody:fix-ipc-readmessage-body-length

Conversation

@professor-moody

@professor-moody professor-moody commented Nov 3, 2026 •

Copy link
Copy Markdown

Rationale for this change

The public IPC message readers need to reject invalid body lengths before arithmetic or IO. This addresses #55400.

What changes are included in this PR?

In cpp/src/arrow/ipc/message.cc, ReadMessageInternal and ReadMessageAsync return Invalid for negative body lengths or a metadata-plus-body length that exceeds the signed 64-bit range. The rebase preserves the newer upstream file-size and field-loading checks. The synchronous guard runs before CheckBodyLength.

Are these changes tested?

ReadMessageValidBodyLength and ReadMessageInvalidBodyLength in cpp/src/arrow/ipc/message_internal_test.cc cover valid reads and rejection in both reader APIs.

Are there any user-facing changes?

Invalid body lengths return Invalid. Valid calls retain the existing behavior. No public API signature changes.

Was AI used for this PR?

The existing human-authored contribution used AI assistance. AI assisted this rebase, source review and validation.

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI

How was this patch generated?

AI assistance reapplied the existing guards and tests to current main and retained the upstream checks.

AI assistance was used in drafting and validating this change; the patch and tests were reviewed and verified by the author.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

Thanks for opening a pull request!

This pull request has been automatically converted to a draft because its title doesn't match Arrow's required format.

If this is not a minor PR, could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

After updating the title, you can mark the pull request as ready for review.

See also:

@github-actions
github-actions Bot marked this pull request as draft November 3, 2026 20:46
@professor-moody professor-moody changed the title GH-XXXXX: [C++][IPC] Validate ReadMessage body_length MINOR: [C++][IPC] Validate ReadMessage body_length Nov 3, 2026
@professor-moody
professor-moody marked this pull request as ready for review November 3, 2026 21:38

@raulcd raulcd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not a minor. Please open an issue and read how to contribute and our AI guidelines.

@professor-moody professor-moody changed the title MINOR: [C++][IPC] Validate ReadMessage body_length GH-55400: [C++][IPC] Validate ReadMessage body_length Nov 4, 2026
@professor-moody

Copy link
Copy Markdown
Author

Thanks @raulcd! Opened #55400 and updated the PR title and description to reference GH-55400.

Reject negative body lengths and metadata-plus-body length
overflow before the public readers perform IO. Preserve upstream
file-size and field-loading checks when rebasing the existing
change onto current main.
@professor-moody
professor-moody force-pushed the fix-ipc-readmessage-body-length branch from 1a11d1f to b2bfaa7 Compare November 18, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants