forked from fmtlib/fmt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
60 additions
and
36 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
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
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,37 @@ | ||
#ifndef FUZZER_COMMON_H | ||
#define FUZZER_COMMON_H | ||
// Copyright (c) 2019, Paul Dreik | ||
// License: see LICENSE.rst in the fmt root directory | ||
|
||
// one can format to either a string, or a buf. buf is faster, | ||
// but one may be interested in formatting to a string instead to | ||
// verify it works as intended. to avoid a combinatoric explosion, | ||
// select this at compile time instead of dynamically from the fuzz data | ||
#define FMT_FUZZ_FORMAT_TO_STRING 1 | ||
|
||
// if fmt is given a buffer that is separately allocated, | ||
// chances that address sanitizer detects out of bound reads is | ||
// much higher. However, it slows down the fuzzing. | ||
#define FMT_FUZZ_SEPARATE_ALLOCATION 1 | ||
|
||
|
||
|
||
// To let the the fuzzer mutation be efficient at cross pollinating | ||
// between different types, use a fixed size format. | ||
// The same bit pattern, interpreted as another type, | ||
// is likely interesting. | ||
// For this, we must know the size of the largest possible type in use. | ||
// There are some problems on old compilers, hence the C++ version check | ||
#if __cplusplus >= 201402L | ||
# include <algorithm> | ||
# include <cstdint> | ||
namespace fmt_fuzzer { | ||
constexpr auto Nfixed = std::max(sizeof(long double), sizeof(std::intmax_t)); | ||
} | ||
#else | ||
namespace fmt_fuzzer { | ||
constexpr auto Nfixed=16; | ||
} | ||
#endif | ||
|
||
#endif // FUZZER_COMMON_H |
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
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
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
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