Skip to content

Antalya 25.8 Backport of #93663 - Fix trash in TokenExtractor - #2673

Open
zvonand wants to merge 2 commits into
antalya-25.8from
backports/antalya-25.8/93663
Open

zvonand wants to merge 2 commits into
antalya-25.8from
backports/antalya-25.8/93663

Conversation

@zvonand

@zvonand zvonand commented Oct 25, 2026

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Critical Bug Fix (crash, data loss, RBAC) or LOGICAL_ERROR

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

The usage of ngram_bf index on a non-UTF-8 data led to an uninitialized memory read, with values that could reside in the resulting index structure. Closes ClickHouse#92576. (ClickHouse#93663 by @alexey-milovidov)

Documentation entry for user-facing changes

...

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Unit tests
  • Performance tests
  • Aarch64 tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • CAS (content-addressed storage; Antalya only)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • OAuth (5m)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

alexey-milovidov and others added 2 commits October 25, 2026 15:25
…rator

Fix trash in `TokenExtractor`

Conflicts committed as-is; the next commit resolves them:
- src/Interpreters/ITokenExtractor.cpp (both modified)
Rewrote the PR's bounds checks for 25.8's pointer-based extractor API (`size_t *` instead of `size_t &`); left out the `SparseGramsTokenExtractor` hunk because that class doesn't exist on 25.8.
@zvonand

zvonand commented Oct 25, 2026

Copy link
Copy Markdown
Member Author

Backporter: cherry-pick conflicts resolved by AI

Conflicted files:

  • src/Interpreters/ITokenExtractor.cpp (both modified)

Commits:

  • 02e7c8a: cherry-pick with the conflicts committed as-is

  • 60a5949: resolution

  • NgramTokenExtractor::nextInString / nextInStringLike: these conflicted because on 25.8, pos, token_start and token_length are pointers, while upstream they are references. I applied the fixes with dereferences: *token_length = std::min(*token_length, length - *token_start), ++i; *pos = i;, and the i + j < length bound in the UTF-8 copy loop.

  • DefaultTokenExtractor::nextInStringLike (upstream's SplitByNonAlphaTokenExtractor): same pointer/reference conflict. I added the *pos < length bound to the copy loop.

  • NoOpTokenExtractor::nextInStringLike: the conflicting block brought in the whole upstream SparseGramsTokenExtractor implementation, which doesn't exist on 25.8. I kept the 25.8 version (the NoOpTokenExtractor exception message) and dropped that class.

@github-actions

Copy link
Copy Markdown

Workflow [PR], commit [60a5949]

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants