Skip to content

Commit

Permalink
Expand the comment on the \p and \P limit.
Browse files Browse the repository at this point in the history
Change-Id: Ib2f359f8ecc4172754a2b02458fc64698e8c1daf
Reviewed-on: https://code-review.googlesource.com/18990
Reviewed-by: Paul Wankadia <[email protected]>
  • Loading branch information
junyer committed Oct 28, 2017
1 parent 15af9e4 commit 2c220e7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions re2/fuzzing/re2_fuzzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down

0 comments on commit 2c220e7

Please sign in to comment.