Skip to content

Reject malformed version strings in ClickHouseVersion parser#1981

Open
il9ue wants to merge 2 commits into
Altinity:antalya-26.3from
il9ue:fix/antalya-26.3/version-parser-strict
Open

Reject malformed version strings in ClickHouseVersion parser#1981
il9ue wants to merge 2 commits into
Altinity:antalya-26.3from
il9ue:fix/antalya-26.3/version-parser-strict

Conversation

@il9ue

@il9ue il9ue commented Jun 28, 2026

Copy link
Copy Markdown

The version parser stopped at the first non-numeric or empty token and treated the rest as the suffix, so 26..1, 26.1. and 26.x.1 were accepted instead of rejected. A typo in the compatibility setting could therefore apply the wrong profile silently.

This restricts the suffix to a single non-empty trailing token, so malformed inputs throw BAD_ARGUMENTS again; valid versions and short forms like 25.3 still parse. Adds a gtest for the parser.
Closes #1831.

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

CI/CD Options

Exclude tests:

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

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

il9ue and others added 2 commits June 28, 2026 09:24
The parser reads the version left to right. The moment it hit anything
that wasn't a number (including a blank piece),
it assumed "this must be the suffix" and quit reading the rest.

Because of this, typos slipped through. In 26..1 the blank between the dots, the x in 26.x.1,
and the empty piece after the dot in 26.1. all got mistaken for a suffix,
so the parser accepted a broken version instead of complaining

The fix: a piece only counts as the suffix if it's the very last piece and isn't blank.
That rules out the three cases above

Normal inputs are unaffected: short values like 25.3 (used in the compatibility setting)
and real builds like 26.3.1.20001.altinityantalya still parse exactly as before

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

antalya-26.3: ClickHouseVersion parser accepts malformed version strings instead of rejecting them (PR #1653)

1 participant