[PATCH] D29462: [libFuzzer] Properly handle exceptions with UnhandledExceptionFilter

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 2 11:19:20 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL293920: [libFuzzer] Properly handle exceptions with UnhandledExceptionFilter. (authored by mpividori).

Changed prior to commit:
  https://reviews.llvm.org/D29462?vs=86850&id=86859#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29462

Files:
  llvm/trunk/lib/Fuzzer/FuzzerUtilWindows.cpp


Index: llvm/trunk/lib/Fuzzer/FuzzerUtilWindows.cpp
===================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerUtilWindows.cpp
+++ llvm/trunk/lib/Fuzzer/FuzzerUtilWindows.cpp
@@ -28,7 +28,7 @@
 
 static const FuzzingOptions* HandlerOpt = nullptr;
 
-LONG CALLBACK ExceptionHandler(PEXCEPTION_POINTERS ExceptionInfo) {
+static LONG CALLBACK ExceptionHandler(PEXCEPTION_POINTERS ExceptionInfo) {
   switch (ExceptionInfo->ExceptionRecord->ExceptionCode) {
     case EXCEPTION_ACCESS_VIOLATION:
     case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
@@ -126,10 +126,7 @@
 
   if (Options.HandleSegv || Options.HandleBus || Options.HandleIll ||
       Options.HandleFpe)
-    if (!AddVectoredExceptionHandler(1, ExceptionHandler)) {
-      Printf("libFuzzer: AddVectoredExceptionHandler failed.\n");
-      exit(1);
-    }
+    SetUnhandledExceptionFilter(ExceptionHandler);
 
   if (Options.HandleAbrt)
     if (SIG_ERR == signal(SIGABRT, CrashHandler)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29462.86859.patch
Type: text/x-patch
Size: 981 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170202/5ec30860/attachment.bin>


More information about the llvm-commits mailing list