
Validate Rust Arrow Run-End Arrays to Prevent Out-of-Bounds Reads
RUSTSEC-2026-0442 affects Rust’s arrow-data crate: insufficient validation of run-end encoded arrays can let a read of the final value go beyond the child values array. Upgrade to a patched arrow-data release and validate untrusted ArrayData before exposing it to read APIs such as TypedRunArray::value. Validation must check the run-end/value relationship, not merely whether the outer buffers can be constructed.
The advisory lists patched releases 60.1.0, 59.3.2, 58.4.1, and 57.3.2 for their respective release branches. Treat older affected versions as unsafe for untrusted run-end encoded data; do not rely on a later value read to detect malformed input.
Environment and baseline
This guide targets Rust 1.82+ (Edition 2021) and the Arrow Rust arrow-data crate. The advisory identifies the affected package as arrow-data, the flaw as improper validation through ArrayData::validate_values, and the relevant read API as TypedRunArray::value. It lists these patched versions:
60.1.0and later in the 60.x line59.3.2and later in the 59.x line58.4.1and later in the 58.x line57.3.2and later in the 57.x line
Pin a patched release compatible with the rest of your Arrow dependency set. For example, if your project uses the 60.x line:
[dependencies]
arrow-data = "60.1.0"
Keep all Arrow crates on compatible versions. A direct dependency override that leaves arrow-array or other Arrow crates on an incompatible version can create build or behavior problems. Confirm the resolved graph rather than assuming the manifest constraint determined the version:
cargo tree -i arrow-data
cargo tree | grep -E 'arrow-(array|buffer|data|schema)'
RUSTSEC-2026-0442 also identifies CVE-2026-111959 and GHSA-gqmm-qrjq-4c7h. The advisory lists versions below 33.0.0 as unaffected; that does not make an old version a sensible security upgrade target. Prefer a currently maintained, patched release line.
Why run-end arrays need structural validation
A run-end encoded array stores values compactly: one child array contains run ends, and another contains the value for each run. A run end says where that run stops in the logical array. Reading a logical index requires locating the run that covers it, then reading the corresponding entry from the values child.
That design depends on a relationship between the two children: the run ends must describe the logical length correctly, and each run must have a corresponding value. If validation accepts an inconsistent final run, a read near the logical end can select a value index outside the values child’s bounds. The outer array may appear constructed successfully while the child relationship needed by value is invalid.
The vulnerable boundary is therefore not simply “is this buffer allocated?” It is “do the run ends and values jointly describe a valid array for every permitted logical read?” This is why calling a value accessor on untrusted data before validation is unsafe. Rust’s type system cannot establish the contents’ semantic consistency just because the data has been wrapped in an Arrow array type.
The unsafe pattern: read first, validate later
A dangerous ingestion flow constructs an array from untrusted or externally supplied ArrayData, converts it to a typed run array, and immediately reads the last logical value:
// Do not use this ordering for untrusted ArrayData.
let array = make_array(untrusted_data);
let run_array = array.as_any().downcast_ref::<TypedRunArray<Int32Type>>()
.expect("expected run-end encoded data");
let last = run_array.value(run_array.len() - 1);
The problem is the ordering: the code reaches value without first requiring full validation. If the data is malformed in the way covered by RUSTSEC-2026-0442, reading the final logical element can access beyond the bounds of the values child. A successful downcast is a type check, not proof that the child arrays are structurally valid.
Adding a bounds check around the logical index does not fix this defect:
if index < run_array.len() {
// Still unsafe to assume the run/value relationship is valid.
let value = run_array.value(index);
}
That check protects against an invalid logical index. It does not validate the encoded run ends or ensure the selected child value exists.
Production fix: patch, validate, then expose
The primary mitigation is to upgrade to a patched arrow-data release. At every trust boundary, validate incoming ArrayData before converting it into an object that application code can read. In Arrow versions that expose ArrayData::validate_full, use the full validator rather than relying on construction or a weaker, partial check:
use arrow_data::ArrayData;
use arrow_array::make_array;
use arrow_array::Array;
fn accept_untrusted(data: ArrayData) -> Result<(), arrow_data::error::ArrowError> {
// Validate nested structure and buffers before any value access.
data.validate_full()?;
let array = make_array(data);
// Continue only after validation. Perform the expected type check
// and application-level checks before exposing the array downstream.
if !array.data_type().is_run_ends_encoded() {
return Err(arrow_data::error::ArrowError::InvalidArgumentError(
"expected run-end encoded array".into(),
));
}
process_validated(array);
Ok(())
}
fn process_validated(array: std::sync::Arc<dyn Array>) {
// Application-specific processing belongs here.
}
Adapt the error type and type-checking method to the exact Arrow release you compile against; the security invariant is unchanged: a full structural validation succeeds before any read accessor runs. If your ingestion path receives an array rather than ArrayData, validate its underlying data at that boundary with the matching API in your pinned Arrow version.
For maintainability, put this ordering behind one private constructor or ingestion function. Return a wrapper such as ValidatedRunArray only after validation succeeds, and do not provide a public constructor that can bypass the check. This makes the trust transition explicit and prevents a later refactor from moving validation after value.
A wrapper can encode the application-level invariant:
use arrow_data::ArrayData;
pub struct ValidatedRunArray {
data: ArrayData,
}
impl TryFrom<ArrayData> for ValidatedRunArray {
type Error = arrow_data::error::ArrowError;
fn try_from(data: ArrayData) -> Result<Self, Self::Error> {
data.validate_full()?;
if !data.data_type().is_run_ends_encoded() {
return Err(arrow_data::error::ArrowError::InvalidArgumentError(
"expected run-end encoded array".into(),
));
}
Ok(Self { data })
}
}
Keep the field private and expose only APIs that operate on the validated value. Do not implement From<ArrayData>: conversion from untrusted data must remain fallible.
Do not treat manual checks as a replacement for the patch
A local check can be useful as defense in depth, but reproducing Arrow’s complete validation logic in application code is brittle. The run-end type, offset representation, logical length, nested child arrays, and empty-array cases all affect what constitutes a valid structure. A hand-written check that verifies only “the final run end is large enough” can miss other invalid relationships—or reject valid representations.
Use the patched crate’s validator as the authoritative structural check. Add application-level policy checks only for constraints your program actually needs, such as a maximum logical length or an expected run-end integer type. Those checks complement structural validation; they do not substitute for it.
Trade-offs
| Approach | Security result | Typical validation cost | Recommendation |
|---|---|---|---|
Read value before validating | Malformed run/value relationships can reach the out-of-bounds read described by RUSTSEC-2026-0442 | None before read | Reject |
Check only index < len() | Checks the logical index, not child-array consistency | Constant time | Insufficient |
| Upgrade and call full validation at ingress | Uses the patched implementation to validate array structure before reads | Traverses relevant array structure; depends on array size and nesting | Default |
| Revalidate on every access | Repeats work without improving safety if immutable data was already validated | Repeated validation overhead | Avoid unless data can change across the boundary |
| Validate once and expose a private validated wrapper | Establishes a clear trust boundary and prevents accidental unchecked construction | Validation once, plus wrapper bookkeeping | Strong application design |
Validation is not free: deeply nested or large arrays can require work proportional to the structure being checked. In typical ingestion pipelines, validating once and then reusing an immutable validated array avoids repeating that cost for every element. Do not skip validation to improve throughput; measure the complete ingestion path, and cache or retain the validated representation where appropriate.
Production pitfalls and edge cases
Final-element access is especially important. The advisory specifically describes reading the last value through APIs such as TypedRunArray::value. Test the last logical index, not just index zero or an interior index. A malformed final run can evade tests that exercise only earlier runs.
Empty arrays need explicit coverage. Code that computes len() - 1 can underflow when len() is zero, independently of the advisory. Check for emptiness before calculating a final index; then ensure the empty representation passes the patched validator.
Do not confuse construction with validation. A builder, deserializer, or conversion that returns an array object does not necessarily prove every nested relationship is valid. Establish validation at the point untrusted bytes or ArrayData enter the application.
Avoid validating one object and reading another. If data can be replaced or reconstructed between validation and use, the validation result does not protect the replacement. Keep the validated object itself behind the boundary, and do not validate a temporary then continue using the original unchecked input.
Keep errors at the trust boundary. Map validation failures to a controlled ingestion error and reject the array. Do not recover by attempting a read anyway. If errors cross a network or service boundary, return a bounded failure response; see Preventing Panic-Induced Denial of Service in Rust: Designing Resilient Error Boundaries.
Verification workflow
First confirm that the dependency graph selects a patched arrow-data version:
cargo tree -i arrow-data
cargo audit
Then run the normal test suite and static checks:
cargo test --all-targets
cargo clippy --all-targets --all-features -- -D warnings
Add regression tests at the ingestion boundary. Cover a valid run-end array, an empty array, a read of the final logical element, and malformed child relationships constructed through the Arrow APIs available in your pinned release. The malformed cases should be rejected by validation before application code can call value. Avoid depending on internal constructors that do not form part of the crate’s supported API; if constructing a malformed value requires lower-level ArrayData builders, keep that fixture isolated in the test module.
For memory-safety investigation, run tests under Miri where the dependency and target support it:
cargo +nightly miri test
Miri is a useful additional check, not a substitute for upgrading: it only detects problems on executed paths and may not support every dependency configuration. For broader confidence, fuzz the boundary that converts untrusted inputs to validated arrays. Seed the corpus with valid and malformed run-end encodings, and assert the key property: either validation rejects the input or all permitted reads complete without panic or invalid memory access. If testing multiple supported Arrow release lines, run the same regression suite against each patched dependency set in CI.
Frequently Asked Questions (FAQ)
Which arrow-data versions fix RUSTSEC-2026-0442?
The advisory lists 60.1.0, 59.3.2, 58.4.1, and 57.3.2 as patched releases for their respective branches. Select a patched version compatible with the rest of your Arrow dependency graph, then verify the resolved version with cargo tree -i arrow-data.
Is checking the index before TypedRunArray::value enough?
No. An index check only establishes that the logical index is within the array’s declared length. It does not establish that the run-end child and values child are consistent, which is the validation failure described by RUSTSEC-2026-0442.
Does Miri replace upgrading from an affected Arrow version?
No. Miri can help detect memory-safety problems on test paths, but it cannot guarantee that every malformed input or read path is exercised. Upgrade to a patched version and validate untrusted arrays before exposing them to value accessors.