-
Notifications
You must be signed in to change notification settings - Fork 543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add fuzzer based on cargo-fuzz #211
Conversation
Pull Request Test Coverage Report for Build 150594647
💛 - Coveralls |
I'm not sure I understand the value of fuzzing sqlparser in general, and of fuzzing without first devising a way to generate SQL-looking input, in particular. Or did you mean to mark this PR as a WIP? Could you elaborate? |
The fuzzer (quickly) generates bytes. Because of a few things at starts generating:
It can also run in parallel (-- -njobs=16) to make it even faster. The example comes from here: https://rust-fuzz.github.io/book/cargo-fuzz/tutorial.html Could also use this to make it a bit more smarter: https://rust-fuzz.github.io/book/cargo-fuzz/structure-aware-fuzzing.html . For example, we could generate arbitrary strings instead of bytes. some random things in the corpus (after running for a few secods), looks like it covers many things in the tokenizer:
The thing is that currently, because of the error above, it doesn't generate any useful reports. Although it may also be an actual problem like MaterializeInc/materialize#3429 |
Also to elaborate on the general goal to parse sqlparser in is mainly to find inputs which make the parser crash. This could be because of any use of partial functions like |
It looks like the size of the problems indeed is the problem (I think related to a recursion problem). |
@Dandandan shall we close this based on the contribution from @PsiACE in #312 ? |
Yeah sounds good. According to some articles, different fuzzers can detect different bugs, but for now it seems we should pick just one option. |
I also filed apache/datafusion#913 in DataFusion for using a "domain specific" fuzzer (aka that generates valid sql) which may be applicable to sqlparser-rs as well |
Currently it returns (after fuzzing):
Error: Fuzz target exited with signal: 11
That looks like a problem in the nightly compiler (LLVM?)