From 2c220e7df3c10d42d74cb66290ec89116bb5e6be Mon Sep 17 00:00:00 2001 From: Paul Wankadia Date: Sat, 28 Oct 2017 13:15:57 +1100 Subject: [PATCH] Expand the comment on the \p and \P limit. Change-Id: Ib2f359f8ecc4172754a2b02458fc64698e8c1daf Reviewed-on: https://code-review.googlesource.com/18990 Reviewed-by: Paul Wankadia --- re2/fuzzing/re2_fuzzer.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/re2/fuzzing/re2_fuzzer.cc b/re2/fuzzing/re2_fuzzer.cc index 1da7a1fab..e0aa96aea 100644 --- a/re2/fuzzing/re2_fuzzer.cc +++ b/re2/fuzzing/re2_fuzzer.cc @@ -60,6 +60,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return 0; // Crudely limit the use of \p and \P. + // Otherwise, we will waste time on inputs that have long runs of Unicode + // character classes. The fuzzer has shown itself to be easily capable of + // generating such patterns that fall within the other limits, but result + // in timeouts nonetheless. The marginal cost is high - even more so when + // counted repetition is involved - whereas the marginal benefit is zero. int backslash_p = 0; for (size_t i = 0; i < size; i++) { if (data[i] == '\\' && i+1 < size && (data[i+1] == 'p' || data[i+1] == 'P'))