Skip to content

[58_maintenance] fix: Buffer::into_mutable return error instead of panic for converting owned sliced when not start at 0 and fix returned Mutable length - #11706

Merged
alamb merged 2 commits into
apache:58_maintenancefrom
Jefffrey:backport_10118_58
Oct 21, 2026
Merged

alamb merged 2 commits into
apache:58_maintenancefrom
Jefffrey:backport_10118_58

Conversation

@Jefffrey

Copy link
Copy Markdown
Contributor

…ing owned sliced when not start at 0 and fix returned Mutable length (apache#10118)

# Which issue does this PR close?

- Closes apache#10117

# Rationale for this change

This include 2 fixes:

1. Calling `Buffer::into_mutable` on owned sliced that
`Buffer::ptr_offset() > 0` panicked before, now returning error
2. Calling `Buffer::into_mutable` on owned slice that
`Buffer::ptr_offset() == 0` returned `MutableBuffer` with length greater
than the original buffer length

# What changes are included in this PR?

1. Updating `Buffer::into_mutable` to return error when `ptr_offset > 0`
2. Set the returned `MutableBuffer` length to the original buffer length
so length is the same

# Are these changes tested?
yes

# Are there any user-facing changes?
not really, except error instead of panic and correct mutable length
@Jefffrey Jefffrey added the bug Squash those bugs label Oct 19, 2026
@github-actions github-actions Bot added arrow-core Core crates related to representing arrow data and removed bug Squash those bugs labels Oct 19, 2026
@Jefffrey
Jefffrey marked this pull request as ready for review October 21, 2026 11:26
@alamb

alamb commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Merging as MSRV failure is unrelated. I will fix in this PR

@alamb
alamb merged commit 0d688a3 into apache:58_maintenance Oct 21, 2026
26 of 27 checks passed
@Jefffrey
Jefffrey deleted the backport_10118_58 branch October 21, 2026 23:47
@alamb alamb added the bug Squash those bugs label Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow-core Core crates related to representing arrow data bug Squash those bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants