fix: validate unaligned offset buffers safely - #946
Merged
paleolimbot merged 2 commits intoSep 25, 2026
Merged
paleolimbot merged 2 commits into
paleolimbot merged 2 commits into
Conversation
Signed-off-by: Efe Gökdemir <efe@rexcode.co.uk>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #946 +/- ##
=======================================
Coverage 78.19% 78.19%
=======================================
Files 106 106
Lines 16843 16845 +2
Branches 1985 1985
=======================================
+ Hits 13170 13172 +2
Misses 2439 2439
Partials 1234 1234 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: Efe Gökdemir <efe@rexcode.co.uk>
paleolimbot
approved these changes
Sep 25, 2026
paleolimbot
left a comment
Member
There was a problem hiding this comment.
Thank you!
I'll open a follow up to try to integrate these more...there are definitely a few more places we're reading unaligned buffers.
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.
Summary
Fixes #945 by making validation of Arrow offset buffers safe for unaligned C Data Interface buffers.
Changes
memcpyhelpers for reading 32-bit and 64-bit buffer values.Testing
ArrowArrayViewValidate: 0with no UBSan diagnostics.cc -std=c99 -Wall -Wextra -Werror -I/tmp/nanoarrow945-dist-fixed/include -Isrc -fsyntax-only src/nanoarrow/common/array.c: passed.git diff --check: passed.Notes
The change keeps the existing validation results and avoids typed dereferences of externally supplied offset buffers. AI assistance was used during investigation and implementation; the submitter reviewed the changed lines and validation results.