Skip to content

ZSTD decode OOB slice panic #8822

Description

@lorenzhs

What happened?

Another fuzzer finding:

thread 'tokio-rt-worker' (588562) panicked at encodings/zstd/src/array.rs:505:28:
range end index 1684678862 out of range for slice of length 249262
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::slice::index::slice_index_fail::do_panic::runtime
   3: core::slice::index::slice_index_fail
   4: vortex_zstd::array::reconstruct_views
   5: vortex_zstd::array::ZstdData::decompress
   6: <vortex_zstd::array::Zstd as vortex_array::array::vtable::VTable>::execute
   7: <vortex_array::array::typed::ArrayData<V> as vortex_array::array::DynArrayData>::execute_unchecked
   8: <vortex_array::array::typed::ArrayData<V> as vortex_array::array::DynArrayData>::execute
   9: <vortex_array::array::erased::ArrayRef as vortex_array::executor::Executable>::execute
  10: vortex_arrow::executor::byte_view::to_arrow_byte_view
  11: vortex_arrow::executor::execute_arrow_naive
  12: vortex_arrow::session::ArrowSession::execute_arrow
  13: vortex_arrow::executor::struct_::create_from_fields
  14: vortex_arrow::executor::struct_::to_arrow_struct
  15: vortex_arrow::executor::execute_arrow_naive
  16: vortex_arrow::session::ArrowSession::execute_arrow
  17: vortex_layout::scan::scan_builder::ScanBuilder<A>::map::{{closure}}
  18: vortex_layout::scan::tasks::split_exec::{{closure}}
  19: <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll
  20: tokio::runtime::task::raw::poll
  21: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
  22: tokio::runtime::scheduler::multi_thread::worker::run
  23: tokio::runtime::task::raw::poll

Steps to reproduce

https://4z2.de/fuzz4.vortex (1.2MB), sha256sum: ee3ad1b98e668dba96632c2038f126d3ac116b7bf12247f94e5e4e779507dec7

Environment

develop as of 10b8173

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA bug issue

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions