Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fuzzer tidying #431

Merged
merged 3 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -411,20 +411,19 @@ library. They are also documented in the pcre2build man page.
Instead of %td or %zu, %lu is used, with a cast for size_t values.

. There is a special option called --enable-fuzz-support for use by people who
want to run fuzzing tests on PCRE2. At present this applies only to the 8-bit
library. If set, it causes an extra library called libpcre2-fuzzsupport.a to
be built, but not installed. This contains a single function called
LLVMFuzzerTestOneInput() whose arguments are a pointer to a string and the
length of the string. When called, this function tries to compile the string
as a pattern, and if that succeeds, to match it. This is done both with no
options and with some random options bits that are generated from the string.
Setting --enable-fuzz-support also causes a binary called pcre2fuzzcheck to
be created. This is normally run under valgrind or used when PCRE2 is
compiled with address sanitizing enabled. It calls the fuzzing function and
outputs information about what it is doing. The input strings are specified
by arguments: if an argument starts with "=" the rest of it is a literal
input string. Otherwise, it is assumed to be a file name, and the contents
of the file are the test string.
want to run fuzzing tests on PCRE2. If set, it causes an extra library
called libpcre2-fuzzsupport.a to be built, but not installed. This contains
a single function called LLVMFuzzerTestOneInput() whose arguments are a
pointer to a string and the length of the string. When called, this function
tries to compile the string as a pattern, and if that succeeds, to match
it. This is done both with no options and with some random options bits that
are generated from the string. Setting --enable-fuzz-support also causes an
executable called pcre2fuzzcheck-{8,16,32} to be created. This is normally
run under valgrind or used when PCRE2 is compiled with address sanitizing
enabled. It calls the fuzzing function and outputs information about what it
is doing. The input strings are specified by arguments: if an argument
starts with "=" the rest of it is a literal input string. Otherwise, it is
assumed to be a file name, and the contents of the file are the test string.

. Releases before 10.30 could be compiled with --disable-stack-for-recursion,
which caused pcre2_match() to use individual blocks on the heap for
Expand Down
6 changes: 3 additions & 3 deletions src/pcre2_fuzzsupport.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ for (int index = 0; index < count; index++)

static void describe_failure(
const char *task,
const unsigned char *data,
size_t size,
const PCRE2_UCHAR *data,
PCRE2_SIZE size,
uint32_t compile_options,
uint32_t match_options,
int errorcode,
Expand Down Expand Up @@ -257,7 +257,7 @@ getrlimit(RLIMIT_STACK, &rlim);
rlim.rlim_cur = STACK_SIZE_MB * 1024 * 1024;
if (rlim.rlim_cur > rlim.rlim_max)
{
fprintf(stderr, "Hard stack size limit is too small (needed 8MiB)!\n");
fprintf(stderr, "Hard stack size limit is too small\n");
_exit(1);
}
rc = setrlimit(RLIMIT_STACK, &rlim);
Expand Down
Loading