Repository navigation
fix(ipc): Don't overflow the footer size check in VerifyFooter and DecodeFooter - #1014
Merged
paleolimbot merged 1 commit intoNov 17, 2026
Merged
Conversation
…codeFooter The footer size plus the size field and magic was summed in size_t and narrowed to int32_t, so a footer size close to INT32_MAX wrapped to a negative number, skipped the ESPIPE check and led to an out-of-bounds read. Compute the sum as int64_t, and add the same check to ArrowIpcDecoderDecodeFooter, which had none.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1014 +/- ##
=======================================
Coverage 78.55% 78.55%
=======================================
Files 106 106
Lines 17297 17298 +1
Branches 2066 2067 +1
=======================================
+ Hits 13587 13588 +1
Misses 2446 2446
Partials 1264 1264 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1013
The footer size check in ArrowIpcDecoderVerifyFooter() and ArrowIpcDecoderDecodeFooter() adds the header size, sizeof(int32_t) and the magic length in size_t and stores the result in an int32_t. ArrowIpcDecoderPeekFooter() only rejects negative footer sizes, so a footer size near INT32_MAX (for example 0x7FFFFFFE) makes the sum wrap to a negative value. The ESPIPE check then passes, and the footer pointer ends up about 2 GiB past the end of the buffer, which VerifyFooter and DecodeFooter then read.
This change:
The approach matches the message header fix in #984 and the check in ArrowIpcDecoderDecodeHeader().
Testing:
New test NanoarrowIpcTest.NanoarrowIpcFooterSizeOverflow (src/nanoarrow/ipc/decoder_test.cc): a 16-byte buffer with footer size 0x7FFFFFFE. It checks that VerifyFooter() returns ESPIPE with the expected message, and that DecodeFooter() returns ESPIPE after PeekFooter().
Ran with the CMake build: nanoarrow_ipc_decoder_test passes. The new test passes with the fix and fails without it.
clang-format 16.0.6 (--dry-run --Werror) and codespell 2.2.5 on the changed files: clean.
Not run: the full ctest suite,
pre-commit run --all-files, and the Meson CI job.