Skip to content

[C++][IPC] ReadSparseCOOIndex does not validate the size of the indices buffer #50054

Closed

Description

@metsw24-max

ReadSparseCOOIndex in cpp/src/arrow/ipc/reader.cc builds the COO indices Tensor with shape {non_zero_length, ndim} directly over indicesBuffer, but never checks the buffer is large enough to hold non_zero_length * ndim index elements. non_zero_length and the shape come unvalidated from the SparseTensor flatbuffer.

The sibling ReadSparseCSXIndex performs this check (indices_minimum_bytes > indices_buffer->length()), but the COO reader does not. A message declaring a large non_zero_length with a small indicesBuffer yields a COO index tensor whose shape exceeds its backing buffer, leading to an out-of-bounds read when the sparse tensor is consumed (for example, converted to dense). A non_zero_length near INT64_MAX also overflows the non_zero_length * ndim * byte_width product, so the size computation needs overflow-safe arithmetic.

Component(s)

C++

Activity

  1. added a commit that references this issue on Jun 30, 2026
  2. added this to the 25.0.0 milestone on Jun 30, 2026
  3. rok commented on Jun 30, 2026

    @rok
    Member

    Issue resolved by pull request 50055
    #50055

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions