Skip to content

AST fuzzer: Fix assertion in TopK serialization#48412

Merged
rschu1ze merged 1 commit intomasterfrom
rs/fix-ast-fuzzer
Apr 5, 2023
Merged

AST fuzzer: Fix assertion in TopK serialization#48412
rschu1ze merged 1 commit intomasterfrom
rs/fix-ast-fuzzer

Conversation

@rschu1ze
Copy link
Copy Markdown
Member

@rschu1ze rschu1ze commented Apr 5, 2023

Problem:
https://s3.amazonaws.com/clickhouse-test-reports/0/fa5b2bd4a5b02336bca8837c473a7124f8ecedf2/fuzzer_astfuzzerasan/report.html

The new assertion in the Varint code was introduced with #48154. It rejects values whose serialization cannot be deserialized (and this behavior cannot be changed due to historical reasons). Such values should be exceptionally rare in practice but AST fuzzer managers to trigger them.

The fix is similar to this fix: Bypass the check by limiting the value to the maximum allowed value.

(if AST fuzzer triggers finds more violations of the assertion, we might consider throwing an exception instead)

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Problem:
  https://s3.amazonaws.com/clickhouse-test-reports/0/fa5b2bd4a5b02336bca8837c473a7124f8ecedf2/fuzzer_astfuzzerasan/report.html

The new assertion in the Varint code was introduced with (*). It rejects
values whose serialization cannot be deserialized (and this behavior
cannot be changed due to historical reasons). Such values should be
exceptionally rare in practice but AST fuzzer managers to trigger them.

The fix is similar to (**): Bypass the check by limiting the value to
the maximum allowed value.

(if AST fuzzer triggers finds more violations of the assertion, we might
consider throwing an exception instead)

(*) #48154
(**) https://github.com/ClickHouse/ClickHouse/pull/48154/files#diff-653c0a18dfdaa86262c78dc6b25550add0487f165b4ad053e86f530388f6203a
@robot-clickhouse robot-clickhouse added the pr-not-for-changelog This PR should not be mentioned in the changelog label Apr 5, 2023
@rschu1ze rschu1ze changed the title AST Fuzzer: Fix assertion in TopK serialization AST fuzzer: Fix assertion in TopK serialization Apr 5, 2023
@alexey-milovidov alexey-milovidov self-assigned this Apr 5, 2023
@rschu1ze rschu1ze merged commit 90a1a75 into master Apr 5, 2023
@rschu1ze rschu1ze deleted the rs/fix-ast-fuzzer branch April 5, 2023 17:16
rschu1ze added a commit that referenced this pull request Apr 11, 2023
PR #48154 introduced a sanity check in the form of a debug assertion
that the input values for VarInt encoding are not too big. Such values
should be exceptionally rare in practice but the AST fuzzer managed to
trigger the assertion regardless. The strategy to deal with such values
until now was to bypass the check by limiting the value to the maximum
allowed value (see #48412). Because a new AST Fuzzer failure appeared
(#48497) and there may be more failures in future, this PR changes the
sanity check from an assert to an exception.

Fixes: #48497
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants