Commit df4ae49
Tweak line-feed regex to avoid exponential backtracking
Before this change, the `(.|\f)*` pattern can lead to exponential
backtracking because it has to try many different combinations. Using
the extra `+` makes the matching 'possessive', so once a match is
found no other alternatives are considered. This is safe for these
regexes, because the pattern in question is always at the end of the
match, so there's no trailing characters that might need to be
'removed' from the match during a backtrack.
This is a follow-up to 2bd2600 and 92677e9.
#cherrypick
PiperOrigin-RevId: 8294571021 parent ea2303e commit df4ae49
File tree
2 files changed
+3
-3
lines changed- libraries
- exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp
- extractor/src/main/java/androidx/media3/extractor/text/webvtt
2 files changed
+3
-3
lines changedLines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| |||
0 commit comments