Skip to content

Validate Iceberg metadata file path for null bytes - #100283

Merged
alexey-milovidov merged 2 commits into
masterfrom
fix-iceberg-null-byte-in-path
Mar 21, 2026
Merged

alexey-milovidov merged 2 commits into
masterfrom
fix-iceberg-null-byte-in-path

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Mar 21, 2026 •

Copy link
Copy Markdown
Member

A null byte in the iceberg_metadata_file_path setting causes std::length_error in filesystem path operations. Since std::length_error is a std::logic_error, the exception handler in executeQuery.cpp treats it as a logical error and aborts the server in debug/sanitizer builds.

Reject paths containing null bytes with a proper BAD_ARGUMENTS exception instead.

Closes #96811
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100176&sha=32a8de2243259ca5c69f22e0599aa41189972a69&name_0=PR&name_1=AST%20fuzzer%20%28amd_tsan%29
#100176

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fix exception when Iceberg metadata file path setting contains a null byte.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.4.1.110 (included in 26.4 and later)
  • Backported to: 26.3.21.5, 25.8.33.4

A null byte in the `iceberg_metadata_file_path` setting causes
`std::length_error` in filesystem path operations. Since
`std::length_error` is a `std::logic_error`, this triggers an abort
in debug/sanitizer builds.

Reject paths containing null bytes with a proper `BAD_ARGUMENTS`
exception instead.

Closes #96811
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100176&sha=32a8de2243259ca5c69f22e0599aa41189972a69&name_0=PR&name_1=AST%20fuzzer%20%28amd_tsan%29

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Mar 21, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [44401dd]

Summary: ✅


AI Review

Summary

This PR validates iceberg_metadata_file_path against embedded null bytes before constructing std::filesystem::path, converting a debug-build terminating std::length_error path into a proper user-facing BAD_ARGUMENTS exception. The change is small, targeted, and matches the linked issue scope. I did not find correctness, safety, or rollout problems in the diff.

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 ✅

Final Verdict

  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Mar 21, 2026
The null byte check throws `BAD_ARGUMENTS`, not `ICEBERG_SPECIFICATION_VIOLATION`.
For a path with null byte in the middle (Test 3), the null byte check also fires
first before any path resolution, so it's also `BAD_ARGUMENTS`.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 83.80% 83.80% +0.00%
Functions 24.60% 24.60% +0.00%
Branches 76.50% 76.40% -0.10%

PR changed lines: PR changed-lines coverage: 87.50% (7/8, 0 noise lines excluded)
Diff coverage report
Uncovered code

@alexey-milovidov alexey-milovidov self-assigned this Mar 21, 2026

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

@alexey-milovidov
alexey-milovidov merged commit 80e6f91 into master Mar 21, 2026
148 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-iceberg-null-byte-in-path branch March 21, 2026 21:04
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 21, 2026
zvonand added a commit to Altinity/ClickHouse that referenced this pull request May 12, 2026
Antalya 26.3 Backport of ClickHouse#100283 - Validate Iceberg metadata file path for null bytes
il9ue pushed a commit to il9ue/ClickHouse that referenced this pull request May 20, 2026
…-byte-in-path

Validate Iceberg metadata file path for null bytes
@scanhex12 scanhex12 added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Aug 19, 2026
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Aug 19, 2026
robot-ch-test-poll added a commit that referenced this pull request Aug 19, 2026
Cherry pick #100283 to 25.8: Validate Iceberg metadata file path for null bytes
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Aug 19, 2026
alexey-milovidov added a commit that referenced this pull request Aug 20, 2026
Backport #100283 to 26.3: Validate Iceberg metadata file path for null bytes
alexey-milovidov added a commit that referenced this pull request Aug 22, 2026
Backport #100283 to 25.8: Validate Iceberg metadata file path for null bytes
kewin-robetti pushed a commit to viasoftkorp/ClickHouse that referenced this pull request Aug 24, 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-bugfix Pull request with bugfix, not backported by default 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.

Another std::exception. Code: 1001, type: std::length_error with Iceberg

5 participants