-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When feeding a `char *` into `re->Match()`, it was converted to a StringPiece, taking its size as `strlen()`. For our (long) input, that wasn't resulting in the correct size, and did then freak out the re2 match input validation if the regular expression has an end anchor, but the endpos wasn't the same as its length. Since the endpos was taken from `s->len`, and the "length" taken via the mentioned StringPiece's strlen() call, they did indeed not match. Worked around by feeding it a properly-constructed std::string instead. I'm a C++ novice at best, but it does the trick, and I'm reasonable certain it's less wrong than before. Fixes #6376. Signed-off-by: Stephan Renatus <[email protected]>
- Loading branch information
1 parent
14bf6fe
commit fb00caa
Showing
3 changed files
with
20 additions
and
5 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
15 changes: 15 additions & 0 deletions
15
...ases/testdata/regexfindallstringsubmatch/test-regexfindallstringsubmatch-large-input.yaml
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,15 @@ | ||
cases: | ||
- data: | ||
input: | ||
long: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabc" | ||
modules: | ||
- | | ||
package test | ||
import future.keywords | ||
p contains m if some m in regex.find_all_string_submatch_n("^.*$", input.long, -1) | ||
note: regexfindallstringsubmatch/large input | ||
query: data.test.p = x | ||
want_result: | ||
- x: | ||
- ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabc"] |
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