Skip to content

GH-49229: [C++] Fix abort when reading IPC file with a union validity bitmap and pre-buffering enabled#49230

Merged
pitrou merged 1 commit into
apache:mainfrom
pitrou:ipc-fuzz-regression
Feb 16, 2026
Merged

GH-49229: [C++] Fix abort when reading IPC file with a union validity bitmap and pre-buffering enabled#49230
pitrou merged 1 commit into
apache:mainfrom
pitrou:ipc-fuzz-regression

Conversation

@pitrou

@pitrou pitrou commented Feb 11, 2026

Copy link
Copy Markdown
Member

Rationale for this change

The logic for loading a Union array from a IPC file was inquiring whether a validity bitmap is present in a V4 metadata file (i.e. buffers[0] != nullptr). However, in the pre-buffering case, the buffers haven't been populated yet at the point, so the check would be ignored and the IPC file reader could happily create a Union array with a top validity bitmap. This could crash later in UnionArray::SetData.

Found by OSS-Fuzz in https://issues.oss-fuzz.com/issues/482161154

Are these changes tested?

By integration test and fuzz regression file. There are no unit tests in the C++ test suite that exercise V4 metadata IPC files with top-level union validity bitmaps.

Are there any user-facing changes?

No.

This PR contains a "Critical Fix". This fixes a controlled crash when reading a pre-V5 IPC file with a top-level union validity bitmap and pre-buffering enabled. Instead a regular error will be returned. There are no known security implications.

@pitrou

pitrou commented Feb 11, 2026

Copy link
Copy Markdown
Member Author

@github-actions crossbow submit -g cpp

@pitrou
pitrou marked this pull request as ready for review February 11, 2026 16:37
@github-actions

Copy link
Copy Markdown

Revision: 1b01906

Submitted crossbow builds: ursacomputing/crossbow @ actions-3993aded3b

Task Status
example-cpp-minimal-build-static GitHub Actions
example-cpp-minimal-build-static-system-dependency GitHub Actions
example-cpp-tutorial GitHub Actions
test-build-cpp-fuzz GitHub Actions
test-conda-cpp GitHub Actions
test-conda-cpp-valgrind GitHub Actions
test-debian-13-cpp-amd64 GitHub Actions
test-debian-13-cpp-i386 GitHub Actions
test-debian-experimental-cpp-gcc-15 GitHub Actions
test-fedora-42-cpp GitHub Actions
test-ubuntu-22.04-cpp GitHub Actions
test-ubuntu-22.04-cpp-20 GitHub Actions
test-ubuntu-22.04-cpp-bundled GitHub Actions
test-ubuntu-22.04-cpp-emscripten GitHub Actions
test-ubuntu-22.04-cpp-no-threading GitHub Actions
test-ubuntu-24.04-cpp GitHub Actions
test-ubuntu-24.04-cpp-bundled-offline GitHub Actions
test-ubuntu-24.04-cpp-gcc-13-bundled GitHub Actions
test-ubuntu-24.04-cpp-gcc-14 GitHub Actions
test-ubuntu-24.04-cpp-minimal-with-formats GitHub Actions
test-ubuntu-24.04-cpp-thread-sanitizer GitHub Actions

@pitrou

pitrou commented Feb 12, 2026

Copy link
Copy Markdown
Member Author

@lidavidm @WillAyd Would you like to take a look?

@pitrou pitrou added the Critical Fix Bugfixes for security vulnerabilities, crashes, or invalid data. label Feb 12, 2026

@lidavidm lidavidm 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.

Sorry for the delay, LGTM

@github-actions github-actions Bot added awaiting merge Awaiting merge and removed awaiting review Awaiting review labels Feb 15, 2026
@pitrou
pitrou merged commit 4ba70c5 into apache:main Feb 16, 2026
77 of 78 checks passed
@pitrou pitrou removed the awaiting merge Awaiting merge label Feb 16, 2026
Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
…lidity bitmap and pre-buffering enabled (apache#49230)

### Rationale for this change

The logic for loading a Union array from a IPC file was inquiring whether a validity bitmap is present in a V4 metadata file (i.e. `buffers[0] != nullptr`). However, in the pre-buffering case, the buffers haven't been populated yet at the point, so the check would be ignored and the IPC file reader could happily create a Union array with a top validity bitmap. This could crash later in `UnionArray::SetData`.

Found by OSS-Fuzz in https://issues.oss-fuzz.com/issues/482161154

### Are these changes tested?

By integration test and fuzz regression file. There are no unit tests in the C++ test suite that exercise V4 metadata IPC files with top-level union validity bitmaps.

### Are there any user-facing changes?

No.

**This PR contains a "Critical Fix".** This fixes a controlled crash when reading a pre-V5 IPC file with a top-level union validity bitmap and pre-buffering enabled. Instead a regular error will be returned. There are no known security implications.

* GitHub Issue: apache#49229

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: C++ Critical Fix Bugfixes for security vulnerabilities, crashes, or invalid data.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants