Skip to content

Improve sanitizer robustness in three unit-test-discovered edge cases - #103489

Merged
alexey-milovidov merged 2 commits into
masterfrom
cursor/only-unit-test-3-fixes-6d84
Apr 24, 2026
Merged

alexey-milovidov merged 2 commits into
masterfrom
cursor/only-unit-test-3-fixes-6d84

Conversation

@yakov-olkhovskiy

@yakov-olkhovskiy yakov-olkhovskiy commented Apr 24, 2026 •

Copy link
Copy Markdown
Member

This PR contains only the three edge-case fixes found by unit tests in the follow-up CI runs related to #99740.

Included fixes:

  • getURLScheme: handle empty input before first character access;
  • Lexer::nextToken: guard max_query_size pointer comparison when lexer input pointers are null;
  • HasSubsequenceImpl::hasSubsequenceUTF8: return early for empty haystack before first UTF-8 decode.

Coverage updates in this PR:

  • parser gtest for null lexer input with max_query_size;
  • stateless SQL regression test for empty-haystack UTF-8 subsequence behavior.

Original PR where issues were discovered: #99740

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Improved sanitizer robustness in parser and string-function edge cases by handling empty input in getURLScheme, avoiding null-pointer arithmetic in Lexer::nextToken max_query_size checks, and short-circuiting UTF-8 subsequence evaluation on empty haystacks before decoding.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)
Open in Web Open in Cursor 

Version info

  • Merged into: 26.5.1.55-master (included in 26.5 and later)

yakov-olkhovskiy and others added 2 commits April 24, 2026 05:53
Fix two sanitizer findings from CI run #99740:

- Guard `Lexer::nextToken` max-query-size check for null input pointers to avoid UBSan pointer arithmetic exception.

- Return early in `HasSubsequenceImpl::hasSubsequenceUTF8` for empty haystack before first UTF-8 decode to avoid MSan uninitialized read exception.

Also add targeted parser/gtest and stateless SQL regression coverage for the new edge cases.

Co-authored-by: Yakov Olkhovskiy <[email protected]>
@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 all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ yakov-olkhovskiy
❌ cursoragent
You have signed the CLA already but the status is still pending? Let us recheck it.

@clickhouse-gh

clickhouse-gh Bot commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [6f9cec5]

Summary: ✅


AI Review

Summary

This PR hardens three edge cases found by sanitizer-driven follow-up testing: empty-input handling in getURLScheme, null-pointer-safe max_query_size handling in Lexer::nextToken, and early return for empty haystack in UTF-8 subsequence evaluation. The changes are focused, low-risk, and accompanied by targeted tests; no blocking or major issues were identified.

ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅
No large/binary files ✅
Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Apr 24, 2026
@yakov-olkhovskiy
yakov-olkhovskiy marked this pull request as ready for review April 24, 2026 06:22
@clickhouse-gh

clickhouse-gh Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 83.80% 83.80% +0.00%
Functions 91.10% 91.10% +0.00%
Branches 76.20% 76.20% +0.00%

Changed lines: 100.00% (20/20) · Uncovered code

Full report · Diff report

@alexey-milovidov alexey-milovidov self-assigned this Apr 24, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Apr 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 24, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Apr 24, 2026
Merged via the queue into master with commit 97d1028 Apr 24, 2026
164 checks passed
@alexey-milovidov
alexey-milovidov deleted the cursor/only-unit-test-3-fixes-6d84 branch April 24, 2026 11:48
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Apr 24, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Apr 24, 2026
…n-crash

Resolve conflict in src/Storages/StorageBuffer.cpp:
- Master refactored the virtuals API (storage_snapshot->virtual_columns
  was removed, virtuals now live in metadata->virtuals).
- The unused 'virtual_columns' member I introduced in PR ClickHouse#102470 was
  dead code; drop it.
- Keep the 'metadata' member — used in generate() via
  columns_desc = metadata->getColumns() to resolve subcolumn names.

Pulls in trunk fix ClickHouse#103489 (yakov-olkhovskiy) for the unrelated
Unit tests (msan, function_prop_fuzzer) failures.
@PedroTadim

Copy link
Copy Markdown
Member

Backporting to fix CI

@robot-ch-test-poll robot-ch-test-poll added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Nov 6, 2026
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Nov 6, 2026
PedroTadim added a commit that referenced this pull request Nov 6, 2026
Backport #103489 to 26.3: Improve sanitizer robustness in three unit-test-discovered edge cases
leshikus pushed a commit that referenced this pull request Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-improvement Pull request with some product improvements pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo v26.3-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants