Skip to content

fix: guard empty fixed-width vectors in CBloomFilter to avoid index-out-of-range panic#25864

Open
SAY-5 wants to merge 1 commit into
matrixorigin:mainfrom
SAY-5:fix-cbloomfilter-empty-fixed-vector
Open

fix: guard empty fixed-width vectors in CBloomFilter to avoid index-out-of-range panic#25864
SAY-5 wants to merge 1 commit into
matrixorigin:mainfrom
SAY-5:fix-cbloomfilter-empty-fixed-vector

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jul 18, 2026

Copy link
Copy Markdown

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #25618

What this PR does / why we need it:

The three fixed-width CBloomFilter methods (testAndAddFixedVector, testFixedVector, addFixedVector) take &fixedData[0] and &results[0] unconditionally, which panics with index out of range [0] with length 0 when the input vector is empty. Their varlena counterparts (testAndAddVarlenaVector, testVarlenaVector, addVarlenaVector) already return early on v.Length() == 0, so behavior on empty input was inconsistent by type.

This adds the same zero-length early return to the fixed-width path so TestVector/AddVector/TestAndAddVector are no-ops on an empty vector instead of panicking, matching the varlena behavior. A regression test covers all three fixed-width APIs.

…ut-of-range panic

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@SAY-5
SAY-5 requested a review from XuPeng-SH as a code owner July 18, 2026 18:28
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@mergify mergify Bot added the kind/bug Something isn't working label Jul 18, 2026
@matrix-meow matrix-meow added the size/S Denotes a PR that changes [10,99] lines label Jul 18, 2026

@gouhongshen gouhongshen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Codex automated review

No concrete regressions found. The guards correctly make empty fixed-width vectors no-ops, matching the existing varlena behavior and issue contract. Local focused tests could not run because Go is unavailable; PR CI reported success.

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

Labels

kind/bug Something isn't working size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants