Repository navigation
Map wire-controlled checks in SerializationReplicated to INCORRECT_DATA - #114186
Merged
Avogar merged 1 commit intoAug 13, 2026
Merged
Conversation
`SerializationReplicated::deserializeBinaryBulkWithMultipleStreams` had three sibling checks that still threw `LOGICAL_ERROR` for conditions decided purely by untrusted native-protocol bytes: - a non-empty target column, reachable via a `Sparse`-over-`Replicated` kind stack (a fresh `ColumnSparse` always seeds one default value, which is then handed to the nested `Replicated` deserialization); - an index row count that disagrees with the block row count; - an unsupported index-type width. In debug and sanitizer builds `LOGICAL_ERROR` is routed to `abortOnFailedAssertion`, so a crafted block aborts the server; in release builds it is the wrong error class and trips CI checks that scan logs for `Logical error`. Change all three to `INCORRECT_DATA`, matching the checks added in #112331 and the analogous `SerializationLowCardinality` code, and extend the native-protocol regression test with the three scenarios. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Contributor
|
Workflow [PR], commit [b3cddfb] Summary: ❌
AI ReviewSummaryThis PR reclassifies three wire-controlled Final Verdict✅ No blocking issues found. LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 14/14 (100.00%) · Uncovered code |
grantholly-clickhouse
approved these changes
Aug 13, 2026
grantholly-clickhouse
left a comment
Contributor
There was a problem hiding this comment.
Pretty simple change. LGTM
vdimir
added a commit
that referenced
this pull request
Nov 18, 2026
The change is taken as in the original (1a44640, #130895), with the adaptations below. Adapted: - `src/Formats/NativeReader.h`, `src/Formats/NativeReader.cpp`: the new `allowed_kinds_` parameter and the `allowed_kinds(allowed_kinds_)` initializer go after `block_missing_values_`, without the master-only `type_cache_` (`NativeReaderTypeCache`, #129831). The branch keeps its own `format_settings_ = std::nullopt` default. - `src/Processors/Formats/Impl/NativeFormat.cpp` (`makeReader`): the `/*type_cache_=*/ nullptr,` argument is dropped. The file merged without a conflict, but would not compile as merged. - `src/Server/TCPHandler.cpp`: the original only adds the `ISerialization::KindSet{ISerialization::Kind::DEFAULT}` argument; `getNativeWireFormatSettings` (#123649) is on its context lines and is not on the branch. `skipDataPacket` passes no format settings here, so an explicit `std::nullopt` stands in that position. `initBlockInput` keeps `getFormatSettings(state.query_context)`, with an explicit `nullptr` for `block_missing_values_` and without `type_cache_`. Both comments of the original are kept. - `src/Interpreters/AsynchronousInsertQueue.cpp`: `IColumn::convertToFullIfWrapped` (#107773) is not on the branch, and `convertToFullIfNeeded` also strips `LowCardinality`. The check uses a file-local `hasWrappedColumn` instead: a `ColumnBLOB`, `ColumnConst`, `ColumnReplicated` or `ColumnSparse` at any nesting depth, `LowCardinality` left alone, nothing converted. The exception and its message are as in the original. The only producers of `pushQueryWithBlock` on the branch are the two calls in `TCPHandler::processAsyncInsertQuery`: a header without columns, and the squashed blocks that `initBlockInput` reads, which now accepts only the default kind. Left out: - `tests/queries/0_stateless/04616_replicated_serialization_oob_index_native_protocol.python` and `.reference`: the scenarios the branch does not have: invalid index type size, index row count mismatch, sparse over replicated (#114186) and huge element count (#129932). The rewrite of the two existing scenarios and the new `replicatedTupleElementScenario` and `replicatedOnInsertScenario` are kept, with their reference lines. - `tests/queries/0_stateless/05473_sparse_truncated_values_native_protocol.python`, `.reference`, `.sh`: the original only edits this test, and it comes from #128363, which is not on the branch (modify/delete conflict). - `docs/resources/develop-contribute/native-protocol/format.mdx`: the branch has no English specification of the `Native` format, so the hunks have nowhere to go (modify/delete conflict). `tests/queries/0_stateless/helpers/fake_native_server.py` is as in the original here. It does not work with the client of this branch, which sends a `Ping` before each query; the next commit adapts it. Everything else merged without conflicts and has the same changed lines as the original. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: #113997
Related: #112331
SerializationReplicated::deserializeBinaryBulkWithMultipleStreamshad three sibling checks that still threwLOGICAL_ERRORfor conditions decided purely by untrusted native-protocol bytes:Sparse-over-Replicatedkind stack (a freshColumnSparsealways seeds one default value, which is then handed to the nestedReplicateddeserialization);In debug and sanitizer builds
LOGICAL_ERRORis routed toabortOnFailedAssertion, so a crafted block sent by any authenticated client aborts the server; in release builds it is the wrong error class and trips CI checks that scan logs forLogical error.This changes all three to
INCORRECT_DATA, matching the checks added in #112331 and the analogousSerializationLowCardinalitycode. The native-protocol regression test04616_replicated_serialization_oob_index_native_protocolis extended with the three scenarios (invalid index type width, index row count mismatch,Sparse-over-Replicated), each asserting error code117and that the server stays alive. Verified against a Debug build.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed the error code reported for some malformed
Replicated-serialized columns received over the Native protocol: these are now rejected withINCORRECT_DATAinstead ofLOGICAL_ERROR(which aborted the server in debug and sanitizer builds).Version info
26.8.1.1364(included in26.8and later)