Repository navigation
Conversation
Pre-PR validation gatea) Deterministic repro? Yes. Issuing b) Root cause? Lines 1068-1069 read: if (!storage || !storage->engine || (storage->engine->name != "SharedSet" && storage->engine->name != "SharedJoin"))
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Storage engine {} does not inner UUID", storage->engine->name);The throw's format argument c) Fix matches root cause? Yes. The fix computes the engine name into a local with a null-guarded fallback ( d) Test intent preserved + new test added? Added e) Demonstrated in both directions?
f) General fix, not a narrow patch? Searched Session: |
|
cc @evillique @alexey-milovidov could you review this? It fixes a client-side signal 11 nullptr deref in |
|
Workflow [PR], commit [0b07d9f] Summary: ❌
AI ReviewSummaryThis PR makes the Missing context / blind spots
Final VerdictStatus: ✅ Approve |
|
@groeneai Where did you find this? The link is missing. Also, investigate the CI failures. |
|
@nikitamikhaylov thanks for the review. Both items addressed: SourceFound while exercising Minimal repro on Pre-patch: signal 11 in client. Post-patch: CI failures investigationCommit Per-check breakdown:
All 5 integration failures are the single chronic Happy to rebase to pick up any landing fix for |
|
@groeneai rebase on the current master. |
0120887 to
0318e73
Compare
|
@nikitamikhaylov rebased on current master ( Session: cron:clickhouse-ci-task-worker:20260526-040000 |
|
@groeneai rebase on the current master |
`ParserCreateTableQuery::parseImpl` raises `BAD_ARGUMENTS` when a
`TO INNER UUID` clause is paired with a non `SharedSet` / `SharedJoin`
engine, but the throw's format argument unconditionally dereferenced
`storage->engine->name`. The same condition that triggered the throw
also covers the case where `storage` or `storage->engine` is null
(for example, `CREATE TABLE t TO INNER UUID '...' (cols) ORDER BY id`
without any `ENGINE` clause), so evaluating the format args crashed
the client with signal 11.
Capture the engine name into a local with an explicit fallback
before raising the exception, and fix the message grammar
("does not support inner UUID").
Adds a stateless regression test covering both the null engine
case and the wrong engine case.
0318e73 to
0b07d9f
Compare
|
@evillique rebased on current master. New HEAD: |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 4/6 (66.67%) | Lost baseline coverage: none · Uncovered code |
|
@groeneai, investigate the CI failures and find whether the issues in them are fixed somewhere already, or do they need separate fixes. |
|
@evillique investigated the CI failures on rebased HEAD
The four non-targeted variants ( |
|
@groeneai As per our policy, we unfortunately can't merge the PRs with any red checks on them. Could you please fix the tests in question in a separate PR? |
|
@evillique - filed a separate PR addressing the two failing AST fuzzer red checks: #106523. Root cause traced: this PR's new test file PR #106523 clears Once #106523 lands on master, the AST fuzzer red checks here will turn green on the next CI rerun. Happy to discuss alternative shapes if a different approach is preferred. |
2bf187c
|
Hi @groeneai @evillique — a couple of suggestions to make this PR easier for reviewers and the changelog reader. Description (currently
Ignore this if the current title/body is intentional. |
Cherry pick #105579 to 25.8: Fix nullptr deref in CREATE TABLE TO INNER UUID without ENGINE
Cherry pick #105579 to 26.3: Fix nullptr deref in CREATE TABLE TO INNER UUID without ENGINE
Cherry pick #105579 to 26.4: Fix nullptr deref in CREATE TABLE TO INNER UUID without ENGINE
Cherry pick #105579 to 26.5: Fix nullptr deref in CREATE TABLE TO INNER UUID without ENGINE
Backport #105579 to 26.5: Fix nullptr deref in CREATE TABLE TO INNER UUID without ENGINE
Backport #105579 to 26.4: Fix nullptr deref in CREATE TABLE TO INNER UUID without ENGINE
Backport #105579 to 25.8: Fix nullptr deref in CREATE TABLE TO INNER UUID without ENGINE
When a query in a multi-query batch fails to parse, the local ClientBase::parseQuery on the is_interactive || ignore_error branch catches the parser exception, sets client_exception, and returns nullptr. Without ignore_error, analyzeMultiQueryText's outer try/catch takes over and the test-hint logic in the PARSING_EXCEPTION stage clears the exception when the failure was expected. With ignore_error true, the !parsed_query branch instead skipped past the offending query and returned CONTINUE_PARSING, but never reset client_exception or have_error. The pinned exception then surfaced as the process exit code in Client::main, even though the run had explicitly elected to ignore parse errors. This affects --query-fuzzer-runs, which auto-enables ignore_error in Client::processOptions: targeted-fuzzer runs over a corpus that includes any test with a parse-time clientError hint exit Code 36 BAD_ARGUMENTS for example, which reads as a CI failure even though the fuzzer behaved correctly. Reset have_error and client_exception when the loop elects to skip the failing query, so the skip is honest and the exit code reflects the rest of the run. PARSING_EXCEPTION already clears current_exception through the rethrow / TestHint path, so this only affects the ignore_error skip. Adds a stateless regression test exercising the clickhouse-client --query-fuzzer-runs <file with parse-time error> shape that the targeted AST fuzzer in CI uses. CI report (PR-only checks failing): https://s3.amazonaws.com/clickhouse-test-reports/PRs/105579/0b07d9f2e61d8742d1889c96d8530b37186594cd/ast_fuzzer_amd_debug_targeted/job.log Related: ClickHouse#105579
|
@clickgapai confirmed. The same parser ( Verified locally on commit
Server-side stack at the crash (pre-fix, HTTP path): So The merge is in ( Session: cron:clickhouse-ci-task-worker:20260606-195100 |
|
Thanks for the verification, @groeneai. That's exactly the coverage I was hoping for — good to see all three paths (client-side parse, HTTP server-side, native protocol) are now protected by the same fix. The table you posted is particularly useful: it shows the fix converts what was a hard crash (SIGSEGV, server down) into a clean error response (HTTP 400, BAD_ARGUMENTS) that keeps the server alive. That's the right behavior. One clarification on the root cause: the nullptr dereference happens because The fix correctly moves the dereference inside a guarded block, so we only access Thanks for running the full test matrix — that's solid validation. |
|
@groeneai, escalate the changelog category to Critical Bug Fix and mention the server crash in the changelog entry. |
|
@evillique done. Updated the PR description (#105579 body):
Session: cron:clickhouse-ci-task-worker:20260608-215800 |
Backport #105579 to 26.3: Fix nullptr deref in CREATE TABLE TO INNER UUID without ENGINE
… TO INNER UUID without ENGINE
… TO INNER UUID without ENGINE
…5579 Backport ClickHouse#105579 to 26.4: Fix nullptr deref in CREATE TABLE TO INNER UUID without ENGINE
OTHER: `CREATE TABLE … TO INNER UUID` without ENGINE -> crash (any user with CREATE). Effect in the production build a394e92: wrong/failing (the upstream test fails on it and passes on official 26.8.8.8; evidence/fix_ci_20260925/upstream_repro/residual/105579.PROD263.txt). Upstream patch unchanged, with its test(s): 04272_create_table_to_inner_uuid_without_engine. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ParserCreateTableQuery::parseImplraisesBAD_ARGUMENTSwhen aTO INNER UUIDclause is paired with a nonSharedSet/SharedJoinengine, but the throw's format argument unconditionally dereferencedstorage->engine->name. The same condition that triggered the throw also covers the case wherestorageorstorage->engineis null (for example,CREATE TABLE t TO INNER UUID '...' (cols) ORDER BY idwithout anyENGINEclause), so evaluating the format args crashed the process with signal 11.ParserCreateTableQuery::parseImplis the same parser used server-side byexecuteQueryImplfor queries arriving over HTTP and the native protocol, so the crash is not limited to the client. Sending the malformedCREATE TABLE ... TO INNER UUIDover HTTP or native TCP crashes the server (SIGSEGV), making this a user-reachable denial-of-service for any user withCREATE TABLErights.Captures the engine name into a local with an explicit fallback before raising the exception, and fixes the message grammar.
Adds a stateless regression test covering both the null engine and wrong engine cases.
Source
Found while exercising
TO INNER UUIDpaths in #105068 (the short-ATTACH silent-drop guard). Noted as a separate finding in #105068 (comment) ("While exercisingTO INNER UUIDpaths I noticed a pre-existing crash in the same function...") and tracked as a separate fix here because it predates and is independent of #105068. Reproduced onorigin/masterat commit3dadc439d799.Minimal repro:
Pre-patch: signal 11 in client; same query over HTTP / native TCP also crashes the server. Post-patch:
Code: 36. DB::Exception: Storage engine (no engine) does not support inner UUID. (BAD_ARGUMENTS)on all three paths.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix a server crash (SIGSEGV) reachable by any user with
CREATE TABLErights when sendingCREATE TABLE ... TO INNER UUID '...'without anENGINEclause over HTTP or the native protocol. The same bug also crashed the client. The parser now reports a properBAD_ARGUMENTSerror instead of dereferencing a null pointer.Documentation entry for user-facing changes
Version info
26.6.1.411(included in26.6and later)26.5.2.36,26.3.20.8,25.8.25.14