Skip to content

Commit

Permalink
Add a test case for bounded iterations.
Browse files Browse the repository at this point in the history
This test case exposes a bug which causes the upper limit of a finite
bound to be ignored in certain cases.

The regular expression used in the test case is a minimal reproducer;
a more practical but less readable and less easily debugged example
would be a regular expression that accepts fully-qualified domain
names.
  • Loading branch information
dag-erling committed Jul 24, 2024
1 parent ca34130 commit fdb68b3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/retest.c
Original file line number Diff line number Diff line change
Expand Up @@ -1511,6 +1511,13 @@ main(int argc, char **argv)
test_exec("abbabbbabaabbbbbbbbbbbba", 0, REG_OK,
0, 24, 0, 10, 10, 22, END);

test_comp("^((a{1,2})?x)*y", REG_EXTENDED | REG_NOSUB, REG_OK);
test_exec("y", 0, REG_OK, END);
test_exec("xy", 0, REG_OK, END);
test_exec("axy", 0, REG_OK, END);
test_exec("aaxy", 0, REG_OK, END);
test_exec("aaaxy", 0, REG_NOMATCH, END);

/* Test repeating something that has submatches inside. */
test_comp("(a){0,5}", REG_EXTENDED, 0);
test_exec("", 0, REG_OK, 0, 0, -1, -1, END);
Expand Down

0 comments on commit fdb68b3

Please sign in to comment.