Skip to content

Fix UBSan: calling .front() on empty vector in tryRerangeRightTableData#96321

Merged
alexey-milovidov merged 1 commit intomasterfrom
fix-ubsan-hashjoin-empty-maps
Feb 8, 2026
Merged

Fix UBSan: calling .front() on empty vector in tryRerangeRightTableData#96321
alexey-milovidov merged 1 commit intomasterfrom
fix-ubsan-hashjoin-empty-maps

Conversation

@alexey-milovidov
Copy link
Copy Markdown
Member

The guard condition checked data->maps.size() > 1 which correctly returned early for multiple disjuncts but allowed size 0 (empty maps, e.g. from CROSS JOIN) to fall through, causing undefined behavior when calling .front() on the empty vector.

Change the condition to data->maps.size() != 1 so we only proceed when there is exactly one map.

Closes #95518

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

…eData`

The guard condition checked `data->maps.size() > 1` which correctly
returned early for multiple disjuncts but allowed size 0 (empty maps,
e.g. from CROSS JOIN) to fall through, causing undefined behavior when
calling `.front()` on the empty vector.

Change the condition to `data->maps.size() != 1` so we only proceed
when there is exactly one map.

Closes #95518

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh Bot commented Feb 7, 2026

Workflow [PR], commit [8e12c4b]

Summary:

job_name test_name status info comment
Stress test (arm_asan, s3) failure
AddressSanitizer: heap-use-after-free (STID: 1367-37fe) FAIL cidb

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Feb 7, 2026
@alexey-milovidov alexey-milovidov self-assigned this Feb 8, 2026
@alexey-milovidov alexey-milovidov merged commit e773da1 into master Feb 8, 2026
259 of 264 checks passed
@alexey-milovidov alexey-milovidov deleted the fix-ubsan-hashjoin-empty-maps branch February 8, 2026 02:04
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Feb 8, 2026
@nickitat nickitat added the post-approved Approved, but after the PR is merged. label Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

post-approved Approved, but after the PR is merged. pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UndefinedBehaviorSanitizer: undefined behavior (STID: 3589-3ecb)

3 participants