Skip to content

Do not fuzz ASTDictionaryLayout#13283

Merged
akuzm merged 7 commits intomasterfrom
aku/dictionary-layout
Aug 6, 2020
Merged

Do not fuzz ASTDictionaryLayout#13283
akuzm merged 7 commits intomasterfrom
aku/dictionary-layout

Conversation

@akuzm
Copy link
Copy Markdown
Contributor

@akuzm akuzm commented Aug 3, 2020

  • some cosmetic changes

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

+ some cosmetic changes
@robot-clickhouse robot-clickhouse added the pr-not-for-changelog This PR should not be mentioned in the changelog label Aug 3, 2020
// Don't fuzz it. It is a somewhat unconventional AST which does not
// directly correspond to the query text, but performs some validation
// by itself. It considers its children to be ASTLiteral * only, so when
// we replace them with something column-like, the client segfaults.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But it should not crash, why don't just throw exception about wrong AST?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That is the problem -- the AST is validated at the parsing stage, so if you change it after that, you get a segfault. It is not possible to trigger from SQL. Normally we keep the AST close to what is written, and validate it later -- this is the only case I encountered so far that doesn't work like this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why don't add yet another validation even if it is not needed at all in normal runs?

@akuzm akuzm marked this pull request as draft August 5, 2020 02:22
@akuzm
Copy link
Copy Markdown
Contributor Author

akuzm commented Aug 6, 2020

@akuzm
Copy link
Copy Markdown
Contributor Author

akuzm commented Aug 6, 2020

So what I did eventually is:

  • Removed a potentially unsafe transformation from query fuzzer (replacing random child ASTLiteral with another AST node). See the comment on why it is not safe.
  • Fixed some problems in dictionary ASTs including broken clone() methods.

I'll merge this now.

@akuzm akuzm marked this pull request as ready for review August 6, 2020 13:42
@akuzm akuzm merged commit 511b097 into master Aug 6, 2020
@akuzm akuzm deleted the aku/dictionary-layout branch August 6, 2020 13:44
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