Skip to content

[57_maintenance] Prevent Rows row index overflow (#9817)#9922

Merged
alamb merged 1 commit into
apache:57_maintenancefrom
alamb:alamb/backport_9817_57
May 6, 2026
Merged

[57_maintenance] Prevent Rows row index overflow (#9817)#9922
alamb merged 1 commit into
apache:57_maintenancefrom
alamb:alamb/backport_9817_57

Conversation

@alamb
Copy link
Copy Markdown
Contributor

@alamb alamb commented May 5, 2026

This PR:

Note: Rows::row_len and Rows::lengths are not present on the 57_maintenance line, so this backport applies the checked row index validation to Rows::row and includes the row_unchecked safety documentation update from the original PR.

- None.

Rows used unchecked usize arithmetic when validating a requested row
index. In optimized builds, very large indexes could wrap the bounds
check before reaching the unchecked row access path.

This adds checked arithmetic for row index validation and reuses it for
both Rows::row and Rows::row_len.

Yes. This adds regression coverage for overflowing row indexes.

Invalid row indexes that overflow during bounds validation now panic
consistently. There are no API changes.
@github-actions github-actions Bot added the arrow Changes to the arrow crate label May 5, 2026
Comment thread arrow-row/src/lib.rs
.expect("row index out of bounds")
}

/// Returns the row at `index` without bounds checking
Copy link
Copy Markdown
Contributor Author

@alamb alamb May 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the description points out the reason #9817 has more changes than this PR is:

Note: Rows::row_len and Rows::lengths are not present on the 57_maintenance line, so this backport applies the checked row index validation to Rows::row and includes the row_unchecked safety documentation update from the original PR.

This was introduced in

which was first released in 58.2.0

@alamb alamb marked this pull request as ready for review May 5, 2026 20:31
Copy link
Copy Markdown
Contributor

@etseidl etseidl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@alamb alamb merged commit 45a5665 into apache:57_maintenance May 6, 2026
14 checks passed
@alamb alamb deleted the alamb/backport_9817_57 branch May 6, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants