Skip to content

Fix null pointer dereference in DataTypeFunction::updateHashImpl - #96479

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix-data-type-function-null-hash
Feb 10, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix-data-type-function-null-hash

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Feb 9, 2026 •

Copy link
Copy Markdown
Member

DataTypeFunction can have null argument types when the lambda is not yet resolved (e.g. created via DataTypes(lambda_arguments_size, nullptr) in resolveFunction). The doGetName method already handled this with a null check, but updateHashImpl did not, causing a null pointer dereference found by AST fuzzer with UBSan.

Also hash null/non-null markers to avoid collisions between types with different null patterns.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=b9e68f4b9b0b33c7db43b00afb3eff4ff2050694&name_0=MasterCI&name_1=AST%20fuzzer%20%28amd_ubsan%29

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 into CHANGELOG.md):

Fix null pointer dereference in certain expressions with lambda functions.

Version info

  • Merged into: 26.2.1.507
  • Backported to: 26.1.5.32, 25.12.9.36, 25.8.19.14

`DataTypeFunction` can have null argument types when the lambda is not
yet resolved (e.g. created via `DataTypes(lambda_arguments_size, nullptr)`
in `resolveFunction`). The `doGetName` method already handled this with
a null check, but `updateHashImpl` did not, causing a null pointer
dereference found by AST fuzzer with UBSan.

Also hash null/non-null markers to avoid collisions between types
with different null patterns.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=b9e68f4b9b0b33c7db43b00afb3eff4ff2050694&name_0=MasterCI&name_1=AST%20fuzzer%20%28amd_ubsan%29

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Feb 9, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [7022918]

Summary: ❌

job_name test_name status info comment
Integration tests (amd_asan, db disk, old analyzer, 5/6) failure
test_acme_tls/test_multi_node.py::test_coordinated_acme_authorization FAIL cidb
test_acme_tls/test_single_node.py::test_acme_authorization FAIL cidb
Integration tests (amd_binary, 5/5) failure
test_acme_tls/test_multi_node.py::test_coordinated_acme_authorization FAIL cidb
test_acme_tls/test_single_node.py::test_acme_authorization FAIL cidb
Integration tests (arm_binary, distributed plan, 1/4) failure
test_acme_tls/test_multi_node.py::test_coordinated_acme_authorization FAIL cidb
test_acme_tls/test_single_node.py::test_acme_authorization FAIL cidb
Integration tests (amd_tsan, 5/6) failure
test_acme_tls/test_single_node.py::test_acme_authorization FAIL cidb
test_acme_tls/test_multi_node.py::test_coordinated_acme_authorization FAIL cidb
macOS smoke test (arm_darwin) error

@clickhouse-gh clickhouse-gh Bot added pr-critical-bugfix pr-must-backport Pull request should be backported intentionally. Use this label with great care! labels Feb 9, 2026
@alexey-milovidov alexey-milovidov self-assigned this Feb 10, 2026
@alexey-milovidov
alexey-milovidov merged commit 298ab79 into master Feb 10, 2026
280 of 390 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-data-type-function-null-hash branch February 10, 2026 10:02
@robot-clickhouse robot-clickhouse added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Feb 10, 2026
robot-clickhouse added a commit that referenced this pull request Feb 10, 2026
robot-clickhouse added a commit that referenced this pull request Feb 10, 2026
robot-clickhouse added a commit that referenced this pull request Feb 10, 2026
robot-clickhouse added a commit that referenced this pull request Feb 10, 2026
@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Feb 10, 2026
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Feb 26, 2026
alexey-milovidov added a commit that referenced this pull request Mar 17, 2026
Backport #96479 to 26.1: Fix null pointer dereference in `DataTypeFunction::updateHashImpl`
alexey-milovidov added a commit that referenced this pull request Mar 17, 2026
Backport #96479 to 25.12: Fix null pointer dereference in `DataTypeFunction::updateHashImpl`
alexey-milovidov added a commit that referenced this pull request Mar 17, 2026
Backport #96479 to 25.8: Fix null pointer dereference in `DataTypeFunction::updateHashImpl`
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Jun 2, 2026
The new unresolved-lambda-placeholder pre-pass in
`QueryAnalyzer::resolveFunction` (commits 14d5ddb and 32a2575) fires
earlier than the downstream `NUMBER_OF_ARGUMENTS_DOESNT_MATCH` that the
original null-arg-types guard from PR ClickHouse#96479 produced. The third
`arrayFold` argument in this regression query is a lambda used as the
initial accumulator (a value slot), which is now rejected upstream with
the more semantically accurate `ILLEGAL_TYPE_OF_ARGUMENT` error
("does not expect a lambda expression as argument N").

CI report:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=106271&sha=02cfedf7885d75af9f9bb520923f28fa6d860a1c

PR: ClickHouse#106271
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-critical-bugfix pr-must-backport Pull request should be backported intentionally. Use this label with great care! 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants