Commit 0ab118b
committed
checkpatch.py: Fix a catastrophic backtracking issue.
The regex_if_macros accidentally implements a catastrophic backtracking
case during matching because it forces a greedy match and evaluation that
causes an explosion of combinations depending on how many blocks appear
in a parenthesized expression.
Consider an expression like:
if (a b c d e f g h i j k) {
The regex engine will have to create an exponential number of matches that
can overload memory and cpu requirements.
Fix this by switching the inner-content match to use a non-greedy approach.
Fixes: aacad86 ("checkpatch: Fix regexp for if, while, etc inside macros.")
Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>1 parent 3023278 commit 0ab118b
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| |||
0 commit comments