8000 bpo-29505: Add more fuzzing for re.compile, re.load and csv.reader (G… · python/cpython@5cbbbd7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5cbbbd7

Browse files
ammaraskargpshead
authored andcommitted
bpo-29505: Add more fuzzing for re.compile, re.load and csv.reader (GH-14255)
Add more fuzz testing for re.compile, re.load and csv.reader
1 parent eb97b92 commit 5cbbbd7

File tree

9 files changed

+493
-16
lines changed

9 files changed

+493
-16
lines changed

Lib/test/test_xxtestfuzz.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ def test_sample_input_smoke_test(self):
1616
_xxtestfuzz.run(b" ")
1717
_xxtestfuzz.run(b"x")
1818
_xxtestfuzz.run(b"1")
19+
_xxtestfuzz.run(b"AAAAAAA")
20+
_xxtestfuzz.run(b"AAAAAA\0")
1921

2022

2123
if __name__ == "__main__":
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
"?"
2+
"abc"
3+
"()"
4+
"[]"
5+
"abc|def"
6+
"abc|def|ghi"
7+
"^xxx$"
8+
"ab\\b\\d\\bcd"
9+
"\\w|\\d"
10+
"a*?"
11+
"abc+"
12+
"abc+?"
13+
"xyz?"
14+
"xyz??"
15+
"xyz{0,1}"
16+
"xyz{0,1}?"
17+
"xyz{93}"
18+
"xyz{1,32}"
19+
"xyz{1,32}?"
20+
"xyz{1,}"
21+
"xyz{1,}?"
22+
"a\\fb\\nc\\rd\\te\\vf"
23+
"a\\nb\\bc"
24+
"(?:foo)"
25+
"(?: foo )"
26+
"foo|(bar|baz)|quux"
27+
"foo(?=bar)baz"
28+
"foo(?!bar)baz"
29+
"foo(?<=bar)baz"
30+
"foo(?<!bar)baz"
31+
"()"
32+
"(?=)"
33+
"[]"
34+
"[x]"
35+
"[xyz]"
36+
"[a-zA-Z0-9]"
37+
"[-123]"
38+
"[^123]"
39+
"]"
40+
"}"
41+
"[a-b-c]"
42+
"[x\\dz]"
43+
"[\\d-z]"
44+
"[\\d-\\d]"
45+
"[z-\\d]"
46+
"\\cj\\cJ\\ci\\cI\\ck\\cK"
47+
"\\c!"
48+
"\\c_"
49+
"\\c~"
50+
"[\\c!]"
51+
"[\\c_]"
52+
"[\\c~]"
53+
"[\\ca]"
54+
"[\\cz]"
55+
"[\\cA]"
56+
"[\\cZ]"
57+
"[\\c1]"
58+
"\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ "
59+
"[\\[\\]\\{\\}\\(\\)\\%\\^\\#\\ ]"
60+
"\\8"
61+
"\\9"
62+
"\\11"
63+
"\\11a"
64+
"\\011"
65+
"\\118"
66+
"\\111"
67+
"\\1111"
68+
"(x)(x)(x)\\1"
69+
"(x)(x)(x)\\2"
70+
"(x)(x)(x)\\3"
71+
"(x)(x)(x)\\4"
72+
"(x)(x)(x)\\1*"
73+
"(x)(x)(x)\\3*"
74+
"(x)(x)(x)\\4*"
75+
"(x)(x)(x)(x)(x)(x)(x)(x)(x)(x)\\10"
76+
"(x)(x)(x)(x)(x)(x)(x)(x)(x)(x)\\11"
77+
"(a)\\1"
78+
"(a\\1)"
79+
"(\\1a)"
80+
"(\\2)(\\1)"
81+
"(?=a){0,10}a"
82+
"(?=a){1,10}a"
83+
"(?=a){9,10}a"
84+
"(?!a)?a"
85+
"\\1(a)"
86+
"(?!(a))\\1"
87+
"(?!\\1(a\\1)\\1)\\1"
88+
"\\1\\2(a(?:\\1(b\\1\\2))\\2)\\1"
89+
"[\\0]"
90+
"[\\11]"
91+
"[\\11a]"
92+
"[\\011]"
93+
"[\\00011]"
94+
"[\\118]"
95+
"[\\111]"
96+
"[\\1111]"
97+
"\\x60"
98+
"\\x3z"
99+
"\\c"
100+
"\\u0034"
101+
"\\u003z"
102+
"foo[z]*"
103+
"\\u{12345}"
104+
"\\u{12345}\\u{23456}"
105+
"\\u{12345}{3}"
106+
"\\u{12345}*"
107+
"\\ud808\\udf45*"
108+
"[\\ud808\\udf45-\\ud809\\udccc]"
109+
"a"
110+
"a|b"
111+
"a\\n"
112+
"a$"
113+
"a\\b!"
114+
"a\\Bb"
115+
"a*?"
116+
"a?"
117+
"a??"
118+
"a{0,1}?"
119+
"a{1,2}?"
120+
"a+?"
121+
"(a)"
122+
"(a)\\1"
123+
"(\\1a)"
124+
"\\1(a)"
125+
"a\\s"
126+
"a\\S"
127+
"a\\D"
128+
"a\\w"
129+
"a\\W"
130+
"a."
131+
"a\\q"
132+
"a[a]"
133+
"a[^a]"
134+
"a[a-z]"
135+
"a(?:b)"
136+
"a(?=b)"
137+
"a(?!b)"
138+
"\\x60"
139+
"\\u0060"
140+
"\\cA"
141+
"\\q"
142+
"\\1112"
143+
"(a)\\1"
144+
"(?!a)?a\\1"
145+
"(?:(?=a))a\\1"
146+
"a{}"
147+
"a{,}"
148+
"a{"
149+
"a{z}"
150+
"a{12z}"
151+
"a{12,"
152+
"a{12,3b"
153+
"{}"
154+
"{,}"
155+
"{"
156+
"{z}"
157+
"{1z}"
158+
"{12,"
159+
"{12,3b"
160+
"a"
161+
"abc"
162+
"a[bc]d"
163+
"a|bc"
164+
"ab|c"
165+
"a||bc"
166+
"(?:ab)"
167+
"(?:ab|cde)"
168+
"(?:ab)|cde"
169+
"(ab)"
170+
"(ab|cde)"
171+
"(ab)\\1"
172+
"(ab|cde)\\1"
173+
"(?:ab)?"
174+
"(?:ab)+"
175+
"a?"
176+
"a+"
177+
"a??"
178+
"a*?"
179+
"a+?"
180+
"(?:a?)?"
181+
"(?:a+)?"
182+
"(?:a?)+"
183+
"(?:a*)+"
184+
"(?:a+)+"
185+
"(?:a?)*"
186+
"(?:a*)*"
187+
"(?:a+)*"
188+
"a{0}"
189+
"(?:a+){0,0}"
190+
"a*b"
191+
"a+b"
192+
"a*b|c"
193+
"a+b|c"
194+
"(?:a{5,1000000}){3,1000000}"
195+
"(?:ab){4,7}"
196+
"a\\bc"
197+
"a\\sc"
198+
"a\\Sc"
199+
"a(?=b)c"
200+
"a(?=bbb|bb)c"
201+
"a(?!bbb|bb)c"
202+
"\xe2\x81\xa3"
203+
"[\xe2\x81\xa3]"
204+
"\xed\xb0\x80"
205+
"\xed\xa0\x80"
206+
"(\xed\xb0\x80)\x01"
207+
"((\xed\xa0\x80))\x02"
208+
"\xf0\x9f\x92\xa9"
209+
"\x01"
210+
"\x0f"
211+
"[-\xf0\x9f\x92\xa9]+"
212+
"[\xf0\x9f\x92\xa9-\xf4\x8f\xbf\xbf]"
213+
"(?<=)"
214+
"(?<=a)"
215+
"(?<!)"
216+
"(?<!a)"
217+
"(?<a>)"
218+
"(?<a>.)"
219+
"(?<a>.)\\k<a>"
118 Bytes
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
XX<a\s*href=(.*?)[\s|>]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
XX^(Tim|Robert)\s+the\s+(Enchanter|Shrubber)$
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
XX/((978[\--– ])?[0-9][0-9\--– ]{10}[\--– ][0-9xX])|((978)?[0-9]{9}[0-9Xx])/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
XX(\+1|1)?[ \-\.]?\(?(?<areacode>[0-9]{3})\)?[ \-\.]?(?<prefix>[0-9]{3})[ \-\.]?(?<number>[0-9]{4})[ \.]*(ext|x)?[ \.]*(?<extension>[0-9]{0,5})

Modules/_xxtestfuzz/fuzz_tests.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ fuzz_builtin_float
22
fuzz_builtin_int
33
fuzz_builtin_unicode
44
fuzz_json_loads
5+
fuzz_sre_compile
6+
fuzz_sre_match
7+
fuzz_csv_reader

0 commit comments

Comments
 (0)
0