Skip to content

[C++][Acero] Potential truncation when merging row arrays #45254

Closed

Description

@zanmato1984

Describe the bug, including details regarding any error messages, version, and platform.

In #43389 I widened the offset within the row table to 64-bit and changed the references of row offset, but I seem to have missed two places:

target->rows_.mutable_offsets()[num_rows] = static_cast<uint32_t>(num_bytes);

and
target->rows_.mutable_offsets()[num_rows] = static_cast<uint32_t>(num_bytes);

(The num_bytes is the accumulation of the sizes of each source row table and the static_cast here is apparently truncating the number which is possibly bigger than 4GB).

Unfortunately our existing test

TEST(HashJoin, LARGE_MEMORY_TEST(BuildSideOver4GBVarLength)) {
didn't catch this. Because the exposure of this bug requires the matching row to be located in the area over 4GB, which depends on the hash algorithm, which is opaque. We can confirm the truncation actually happens by adding DCHECK_LE(num_bytes, uint32_max).

Component(s)

C++

Activity

  1. self-assigned this
    on Jan 14, 2025
  2. changed the title [-][C++][Acero] Potential overflow when merging row arrays[/-] [+][C++][Acero] Potential truncation when merging row arrays[/+] on Jan 14, 2025
  3. added a commit that references this issue on Jan 14, 2025
  4. added this to the 20.0.0 milestone on Jan 14, 2025
  5. zanmato1984 commented on Jan 14, 2025

    @zanmato1984
    ContributorAuthor

    Issue resolved by pull request 45255
    #45255

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