llvm/compiler-rt/test/fuzzer/UncaughtException.cpp
Joe Pletcher f897e82bfd [fuzzer] Add Windows Visual C++ exception intercept
Adds a new option, `handle_winexcept` to try to intercept uncaught
Visual C++ exceptions on Windows. On Linux, such exceptions are handled
implicitly by `std::terminate()` raising `SIBABRT`. This option brings the
Windows behavior in line with Linux.

Unfortunately this exception code is intentionally undocumented, however
has remained stable for the last decade. More information can be found
here: https://devblogs.microsoft.com/oldnewthing/20100730-00/?p=13273

Reviewed By: morehouse, metzman

Differential Revision: https://reviews.llvm.org/D89755
2020-11-12 13:11:14 -08:00

11 lines
241 B
C++

#include <cstdint>
#include <vector>
extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, size_t size) {
std::vector<uint8_t> v;
// Intentionally throw std::length_error
v.reserve(static_cast<uint64_t>(-1));
return 0;
}