Skip to content

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

Merged
mergify[bot] merged 1 commit into
matrixorigin:mainfrom
SAY-5:fix-cbloomfilter-empty-fixed-vector
Jul 19, 2026
Merged

fix: guard empty fixed-width vectors in CBloomFilter to avoid index-out-of-range panic#25864
mergify[bot] merged 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
Contributor

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.

@XuPeng-SH
XuPeng-SH requested a review from cpegeric July 19, 2026 02:01

@XuPeng-SH XuPeng-SH 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.

Deep review completed against f58f026. No merge-blocking findings.

The zero-length guard is placed before both fixedData[0] and results[0] in all three fixed-width vector paths. TestVector returns an empty result, while AddVector and TestAndAddVector are no-ops and invoke no callbacks, matching the existing varlena semantics. The non-empty path is unchanged apart from an O(1) length check, and the change introduces no new ownership, allocation-growth, concurrency, or wait-for edges.

Local verification passed:

  • focused regression test
  • full pkg/common/bloomfilter test suite
  • full package with -race
  • go vet

Non-blocking follow-up: the regression test could pass a counting callback and assert zero invocations instead of passing nil. Fixed const-null vectors with logical length greater than zero and empty backing data are a separate pre-existing API boundary and should be handled independently; this PR neither introduces nor claims to fix it.

Approved.

@mergify mergify Bot added the queued label Jul 19, 2026
@mergify

mergify Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-07-19 02:28 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • Checks skipped · PR is already up-to-date
  • Merged2026-07-19 02:29 UTC · at f58f0260854383f19ad6a8757764d12ac4515f56 · squash

This pull request spent 10 seconds in the queue, including 1 second running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection] (documentation)
  • github-review-decision = APPROVED [🛡 GitHub branch protection] (documentation)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-neutral = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-skipped = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-skipped = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64

@mergify
mergify Bot merged commit 35ff203 into matrixorigin:main Jul 19, 2026
23 of 24 checks passed
@mergify mergify Bot removed the queued label Jul 19, 2026
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.

5 participants