Skip to content

fix: allow null data for empty binary and string views during append - #940

Merged
paleolimbot merged 1 commit into
apache:mainfrom
fornwall:null-for-empty-buffer-view
Sep 12, 2026
Merged

paleolimbot merged 1 commit into
apache:mainfrom
fornwall:null-for-empty-buffer-view

Conversation

@fornwall

Copy link
Copy Markdown
Contributor

ArrowBufferView and ArrowStringView allow a null data pointer when their size is zero:

If size_bytes is 0, this value may be NULL.

Appending these views to binary-view or string-view arrays currently passes the null pointer to memcpy, which is undefined behaviour even for a zero-byte copy as flagged by UBSan.

Skip the inline copy for empty values to fix that.

Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>

@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!

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.19%. Comparing base (33af79a) to head (4e4d712).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #940      +/-   ##
==========================================
+ Coverage   78.16%   78.19%   +0.02%     
==========================================
  Files         106      106              
  Lines       16842    16843       +1     
  Branches     1984     1985       +1     
==========================================
+ Hits        13165    13170       +5     
+ Misses       2443     2439       -4     
  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.

@paleolimbot paleolimbot changed the title fix: allow null data for empty binary and string views fix: allow null data for empty binary and string views during append Sep 12, 2026
@paleolimbot
paleolimbot merged commit b896d19 into apache:main Sep 12, 2026
43 checks passed
@fornwall
fornwall deleted the null-for-empty-buffer-view branch September 12, 2026 07:16
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.

3 participants