@@ -31,13 +31,13 @@ def _test_getaddrinfo(self, *args, _patch=False, **kwargs):
31
31
a1 = patched_getaddrinfo (* args , ** kwargs )
32
32
else :
33
33
a1 = socket .getaddrinfo (* args , ** kwargs )
34
- except socket .gaierror as ex :
34
+ except ( socket .gaierror , UnicodeError ) as ex :
35
35
err = ex
36
36
37
37
try :
38
38
a2 = self .loop .run_until_complete (
39
39
self .loop .getaddrinfo (* args , ** kwargs ))
40
- except socket .gaierror as ex :
40
+ except ( socket .gaierror , UnicodeError ) as ex :
41
41
if err is not None :
42
42
self .assertEqual (ex .args , err .args )
43
43
else :
@@ -187,6 +187,18 @@ def test_getaddrinfo_20(self):
187
187
self ._test_getaddrinfo ('127.0.0.1' , 80 , type = socket .SOCK_STREAM ,
188
188
flags = socket .AI_CANONNAME , _patch = patch )
189
189
190
+ # https://github.com/libuv/libuv/security/advisories/GHSA-f74f-cvh7-c6q6
191
+ # See also: https://github.com/MagicStack/uvloop/pull/600
192
+ def test_getaddrinfo_21 (self ):
193
+ payload = f'0x{ "0" * 246 } 7f000001.example.com' .encode ('ascii' )
194
+ self ._test_getaddrinfo (payload , 80 )
195
+ self ._test_getaddrinfo (payload , 80 , type = socket .SOCK_STREAM )
196
+
197
+ def test_getaddrinfo_22 (self ):
198
+ payload = f'0x{ "0" * 246 } 7f000001.example.com'
199
+ self ._test_getaddrinfo (payload , 80 )
200
+ self ._test_getaddrinfo (payload , 80 , type = socket .SOCK_STREAM )
201
+
190
202
######
191
203
192
204
def test_getnameinfo_1 (self ):
0 commit comments