Skip to content

Check for output offsets int32 overflow in list APIs - #23652

Open
davidwendt wants to merge 1 commit into
NVIDIA:mainfrom
davidwendt:interleave-list-overflow
Open

Check for output offsets int32 overflow in list APIs#23652
davidwendt wants to merge 1 commit into
NVIDIA:mainfrom
davidwendt:interleave-list-overflow

Conversation

@davidwendt

Copy link
Copy Markdown
Contributor

Description

Adds int32 overflow check logic to list column functions when building output offsets by replacing calls to thrust::exclusive_scan with cudf::detail::size_to_offsets which returns the total size (last element) as an int64 value and then comparing it to max(int32) and throwing an exception as appropriate.
This was found while working on related size_type as offsets type cleanup work.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@davidwendt davidwendt self-assigned this Aug 13, 2026
@davidwendt
davidwendt requested a review from a team as a code owner August 13, 2026 19:28
@davidwendt davidwendt added bug Something isn't working 3 - Ready for Review Ready for review by team libcudf Affects libcudf (C++/CUDA) code. labels Aug 13, 2026
@davidwendt davidwendt added the non-breaking Non-breaking change label Aug 13, 2026
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Added validation to prevent list operations from exceeding the maximum supported 32-bit size.
    • Operations now report an overflow error instead of producing invalid offsets when results are too large.
  • Maintenance

    • Updated copyright notices.

Walkthrough

The CUDA list concatenation and interleaving paths now use sizes_to_offsets for offset construction and reject totals above the maximum int32_t range. Copyright notices were updated.

Changes

List offset construction and validation

Layer / File(s) Summary
Offset construction and bounds validation
cpp/src/lists/combine/concatenate_rows.cu, cpp/src/lists/interleave_columns.cu
Both paths replace Thrust exclusive scans with cudf::detail::sizes_to_offsets and throw std::overflow_error when generated offsets exceed int32_t limits. Required headers and copyright notices were updated.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to 94616

The change is localized to overflow handling in list APIs, with no concrete merge-blocking risk identified; it is merge-ready after normal checks.

Possibly related PRs

  • NVIDIA/cudf#23607: Modifies list-offset handling in the same two CUDA files and adds related int32_t offset checks.

Suggested reviewers: shrshi, bdice, mythrocks, pointkernel, ttnghia

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: checking for int32 overflow in output offsets for list APIs.
Description check ✅ Passed The description accurately explains the overflow checks, API replacement, exception behavior, and test coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔇 Additional comments (3)
cpp/src/lists/combine/concatenate_rows.cu (2)

2-2: LGTM!

Also applies to: 13-13


114-122: 📐 Maintainability & Code Quality

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify coverage for offset construction.

The supplied cohort contains no test or benchmark files. Verify that the full PR adds tests for empty inputs, null lists, sliced lists, normal totals, int32_t boundary totals, and overflowing totals for both paths.

As per coding guidelines, **/*: “Add unit tests and unit benchmarks.” Based on learnings, list tests must include boundary sizes, null values, and sliced columns.

cpp/src/lists/interleave_columns.cu (1)

2-2: LGTM!


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 5ff6e72a-c5a1-4a32-a248-9806ce4a9309

📥 Commits

Reviewing files that changed from the base of the PR and between 0b57a3b and 9461695.

📒 Files selected for processing (2)
  • cpp/src/lists/combine/concatenate_rows.cu
  • cpp/src/lists/interleave_columns.cu

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

Labels

3 - Ready for Review Ready for review by team bug Something isn't working libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant