Skip to content

fix: validate unaligned offset buffers safely - #946

Merged
paleolimbot merged 2 commits into
apache:mainfrom
efegokdemir:codex/issue-945-unaligned-offset-validation
Sep 25, 2026
Merged

paleolimbot merged 2 commits into
apache:mainfrom
efegokdemir:codex/issue-945-unaligned-offset-validation

Conversation

@efegokdemir

Copy link
Copy Markdown
Contributor

Summary

Fixes #945 by making validation of Arrow offset buffers safe for unaligned C Data Interface buffers.

Changes

  • Add byte-based memcpy helpers for reading 32-bit and 64-bit buffer values.
  • Use the helpers for default and full offset validation, including string, list, and large variants.
  • Add regression coverage for unaligned string and large-string offset buffers.

Testing

  • Upstream reproducer with Clang UBSan: reproduced misaligned-load failure.
  • Patched bundle with Clang UBSan: passed; ArrowArrayViewValidate: 0 with 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.
  • Full CMake/GoogleTest suite: not run because CMake and GoogleTest are not installed in the local environment.

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.

Signed-off-by: Efe Gökdemir <efe@rexcode.co.uk>
@codecov-commenter

codecov-commenter commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.19%. Comparing base (ec8a58c) to head (46f59e5).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Efe Gökdemir <efe@rexcode.co.uk>

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

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.

@paleolimbot
paleolimbot merged commit 8f81815 into apache:main Sep 25, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ArrowArrayViewValidate() reads unaligned offsets buffers through int32_t/int64_t pointers

3 participants