-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/MacroModel/fast_io
- Loading branch information
Showing
6 changed files
with
114 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
#include <fast_io.h> | ||
|
||
fast_io::c_file_unlocked obf("/dev/null", fast_io::open_mode::out); | ||
fast_io::c_file_unlocked obf( | ||
#if defined(_WIN32) && !defined(__WINE__) | ||
"nul" | ||
#else | ||
"/dev/null" | ||
#endif | ||
, | ||
fast_io::open_mode::out); | ||
|
||
extern "C" int LLVMFuzzerTestOneInput(std::uint8_t const *ptr, std::size_t n) noexcept | ||
extern "C" int LLVMFuzzerTestOneInput(std::uint8_t const *pptr, std::size_t n) noexcept | ||
{ | ||
write(obf, ptr, ptr + n); | ||
::std::byte const *ptr{reinterpret_cast<::std::byte const *>(pptr)}; | ||
::fast_io::operations::write_all_bytes(obf, ptr, ptr + n); | ||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <fast_io.h> | ||
#include <fast_io_legacy.h> | ||
|
||
fast_io::filebuf_file obf( | ||
#if defined(_WIN32) && !defined(__WINE__) | ||
"nul" | ||
#else | ||
"/dev/null" | ||
#endif | ||
, | ||
fast_io::open_mode::out); | ||
|
||
|
||
extern "C" int LLVMFuzzerTestOneInput(std::uint8_t const *pptr, std::size_t n) noexcept | ||
{ | ||
char const *ptr{reinterpret_cast<char const *>(pptr)}; | ||
using namespace fast_io::mnp; | ||
::fast_io::operations::write_all(obf, ptr, ptr + n); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <fast_io.h> | ||
|
||
fast_io::u32c_file_unlocked obf( | ||
#if defined(_WIN32) && !defined(__WINE__) | ||
"nul" | ||
#else | ||
"/dev/null" | ||
#endif | ||
, | ||
fast_io::open_mode::out); | ||
|
||
extern "C" | ||
[[__gnu__::__weak__]] | ||
uintptr_t __sancov_lowest_stack{}; | ||
|
||
extern "C" int LLVMFuzzerTestOneInput(std::uint8_t const *pptr, std::size_t n) noexcept | ||
{ | ||
using chartype = char32_t; | ||
char32_t const *ptr{reinterpret_cast<char32_t const *>(pptr)}; | ||
using namespace fast_io::mnp; | ||
::fast_io::operations::write_all(obf, ptr, ptr + n / sizeof(char32_t)); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <fast_io.h> | ||
|
||
fast_io::wc_file_unlocked obf( | ||
#if defined(_WIN32) && !defined(__WINE__) | ||
"nul" | ||
#else | ||
"/dev/null" | ||
#endif | ||
, | ||
fast_io::open_mode::out); | ||
|
||
extern "C" | ||
[[__gnu__::__weak__]] | ||
uintptr_t __sancov_lowest_stack{}; | ||
|
||
struct usefwide | ||
{ | ||
usefwide() | ||
{ | ||
fwide(obf.fp, 1); | ||
} | ||
}; | ||
#ifdef USE_FWIDE | ||
usefwide t; | ||
#endif | ||
|
||
extern "C" int LLVMFuzzerTestOneInput(std::uint8_t const *pptr, std::size_t n) noexcept | ||
{ | ||
wchar_t const *ptr{reinterpret_cast<wchar_t const *>(pptr)}; | ||
using namespace fast_io::mnp; | ||
::fast_io::operations::write_all(obf, ptr, ptr + n / sizeof(wchar_t)); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <fast_io.h> | ||
#include <fast_io_legacy.h> | ||
|
||
fast_io::wfilebuf_file obf( | ||
#if defined(_WIN32) && !defined(__WINE__) | ||
"nul" | ||
#else | ||
"/dev/null" | ||
#endif | ||
, | ||
fast_io::open_mode::out); | ||
|
||
|
||
extern "C" int LLVMFuzzerTestOneInput(std::uint8_t const *pptr, std::size_t n) noexcept | ||
{ | ||
wchar_t const *ptr{reinterpret_cast<wchar_t const *>(pptr)}; | ||
using namespace fast_io::mnp; | ||
::fast_io::operations::write_all(obf, ptr, ptr + n / sizeof(wchar_t)); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters