Skip to content
Commit d64360d9 authored by Marcos Pividori's avatar Marcos Pividori
Browse files

[libFuzzer] Properly handle exceptions with UnhandledExceptionFilter.

Use SetUnhandledExceptionFilter instead of AddVectoredExceptionHandler.

According to the documentation on Structured Exception Handling, this is the
order for the Exception Dispatching:
+ If the process is being debugged, the system notifies the debugger.
+ The Vectored Exception Handler is called.
+ The system attempts to locate a frame-based exception handler by searching the
 stack frames of the thread in which the exception occurred.
+ If no frame-based handler can be found, the UnhandledExceptionFilter filter is
 called.
+ Default handling based on the exception type.

So, similar to what we do for asan, we should use SetUnhandledExceptionFilter
instead of AddVectoredExceptionHandler, so user's code that is being fuzzed can
execute frame-based exception handlers before we catch them . We want to catch
unhandled exceptions, not all the exceptions.

Differential Revision: https://reviews.llvm.org/D29462

llvm-svn: 293920
parent 37e24591
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment