-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Simple C++ exceptions fuzzer #13485
base: main
Are you sure you want to change the base?
Simple C++ exceptions fuzzer #13485
Conversation
Added a simple reducer which seems to work well. It finds stuff like this: void func_0() {
puts("log(1)");
try {
try {
throw 0;
} catch(...) {
try {
while (getBoolean()) {
}
} catch(...) {
}
}
} catch(...) {
}
} That crashes clang with
|
Can also find bugs in binaryen, this crashes with
void func_0() {
try {
puts("log(1)");
} catch(...) {
while (getBoolean()) {
throw 0;
}
}
} I think this might be the rethrow bug that @aheejin mentions in WebAssembly/binaryen#3562 that will be fixed soon. |
Thanks, this is great! I'll check those crashing examples soon. |
…a call (#3594) This was an unfortunate case of the order of execution of call arguments. link(self->currBasicBlock, self->startBasicBlock()) would run the call first, which sets currBasicBlock, so we'd end up with the same value for both parameters. Without this fix, the testcase would drop the result of the call, as it thought it had no uses. Also improve debug logging here a tiny bit. Found by emscripten-core/emscripten#13485
We were missing a pop of catchIndexStack at a Delegate. It ends the scope, so it should do that, like TryEnd does. Found by emscripten-core/emscripten#13485 on -O2.
Before this we would assert on hashing e.g. (br $x) by itself, without the context so we recognized the name $x. Somehow that was not an issue until delegate, we just happened to not hash such things. I believe I remember that @aheejin noticed this issue before, but given we didn't have a testcase, we deferred fixing it - now is the time, I guess, as with delegate it is easy to get e.g. CodeFolding to hash a Try with a delegate. Issue found by emscripten-core/emscripten#13485
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant. |
This is a quick and simple fuzzer, but it should generate some interesting patterns. It should also allow for easy reduction of testcases (see comments in the source for the technique).
Example random output:
This is capable of crashing clang (on
WebAssemblyCFGStackify
) with-fwasm-exceptions
. I assume it's too early to fuzz it?cc @aheejin @tlively @dschuff