Skip to content

fix(array): don't abort on a NUL byte in a field name - #8664

Closed
miniex wants to merge 1 commit into
vortex-data:developfrom
miniex:fix/reject-nul-field-names
Closed

fix(array): don't abort on a NUL byte in a field name#8664
miniex wants to merge 1 commit into
vortex-data:developfrom
miniex:fix/reject-nul-field-names

Conversation

@miniex

@miniex miniex commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

A struct field name with an interior NUL byte aborted the whole process (SIGABRT) when the schema was exported across the Arrow C Data FFI: arrow-rs copies the name into a CString in a non-unwinding context, so CString::new failing on the NUL escalated to an abort instead of an error (#8652). to_arrow_schema / to_data_type_naive and ArrowSession::to_arrow_field now reject a NUL byte in a field name up front, so a crafted or mislabeled file surfaces a recoverable VortexError instead of taking down the reader.

This rejects only NUL, the byte that actually aborts (other control characters are valid in a CString), and guards the Arrow export boundary rather than the writer, so it also covers a DType from a non-Vortex producer.

Closes: #8652

Testing

Added tests that to_arrow_schema (top-level and nested struct) and ArrowSession::to_arrow_field reject a NUL field name. cargo nextest run -p vortex-array passes; fmt --all + clippy --all-targets --all-features clean.


I'm Korean, so sorry if any wording reads a little awkward.

an interior NUL in a struct field name aborted the process when the schema was
exported over the arrow c ffi: arrow copies the name into a `CString` in a
non-unwinding context, so the failure escalated to `SIGABRT`. `to_arrow_schema`
and `ArrowSession::to_arrow_field` now reject such names, returning a `VortexError`
instead.

Closes vortex-data#8652

Signed-off-by: Han Damin <miniex@daminstudio.net>
@github-actions

Copy link
Copy Markdown
Contributor

This PR has been marked as stale because it has been open for 14 days with no activity. Please comment or remove the stale label if you wish to keep it active, otherwise it will be closed in 7 days

@github-actions github-actions Bot added the stale This PR is stale and will be auto-closed soon label Jul 22, 2026
Comment on lines +314 to +319
pub(crate) fn validate_arrow_field_name(name: &str) -> VortexResult<()> {
if name.contains('\0') {
vortex_bail!("field name {name:?} cannot be exported to Arrow: contains a NUL byte");
}
Ok(())
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does arrow use nul str or str + len

@robert3005 robert3005 Jul 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I made this fix in arrow-rs apache/arrow-rs#10328. Arrow supports names that are not valid c strings unfortunately

@miniex miniex closed this Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale This PR is stale and will be auto-closed soon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NUL byte in a struct field name aborts the process (SIGABRT) via Arrow FFI schema export

3 participants