Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
5e48e3db
Kaydet (Commit)
5e48e3db
authored
May 14, 2019
tarafından
Nicolai Moore
Kaydeden (comit)
Inada Naoki
May 14, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-36845: validate integer network prefix when constructing IP networks (GH-13298)
üst
f0be4bbb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
0 deletions
+23
-0
ipaddress.py
Lib/ipaddress.py
+4
-0
test_ipaddress.py
Lib/test/test_ipaddress.py
+16
-0
ACKS
Misc/ACKS
+1
-0
2019-05-14-07-57-02.bpo-36845._GtFFf.rst
...S.d/next/Library/2019-05-14-07-57-02.bpo-36845._GtFFf.rst
+2
-0
No files found.
Lib/ipaddress.py
Dosyayı görüntüle @
5e48e3db
...
...
@@ -1108,6 +1108,8 @@ class _BaseV4:
if
arg
not
in
cls
.
_netmask_cache
:
if
isinstance
(
arg
,
int
):
prefixlen
=
arg
if
not
(
0
<=
prefixlen
<=
cls
.
_max_prefixlen
):
cls
.
_report_invalid_netmask
(
prefixlen
)
else
:
try
:
# Check for a netmask in prefix length form
...
...
@@ -1538,6 +1540,8 @@ class _BaseV6:
if
arg
not
in
cls
.
_netmask_cache
:
if
isinstance
(
arg
,
int
):
prefixlen
=
arg
if
not
(
0
<=
prefixlen
<=
cls
.
_max_prefixlen
):
cls
.
_report_invalid_netmask
(
prefixlen
)
else
:
prefixlen
=
cls
.
_prefix_from_prefix_string
(
arg
)
netmask
=
IPv6Address
(
cls
.
_ip_int_from_prefix
(
prefixlen
))
...
...
Lib/test/test_ipaddress.py
Dosyayı görüntüle @
5e48e3db
...
...
@@ -466,6 +466,14 @@ class NetmaskTestMixin_v4(CommonTestMixin_v4):
assertBadNetmask
(
"1.1.1.1"
,
"pudding"
)
assertBadNetmask
(
"1.1.1.1"
,
"::"
)
def
test_netmask_in_tuple_errors
(
self
):
def
assertBadNetmask
(
addr
,
netmask
):
msg
=
"
%
r is not a valid netmask"
%
netmask
with
self
.
assertNetmaskError
(
re
.
escape
(
msg
)):
self
.
factory
((
addr
,
netmask
))
assertBadNetmask
(
"1.1.1.1"
,
-
1
)
assertBadNetmask
(
"1.1.1.1"
,
33
)
def
test_pickle
(
self
):
self
.
pickle_test
(
'192.0.2.0/27'
)
self
.
pickle_test
(
'192.0.2.0/31'
)
# IPV4LENGTH - 1
...
...
@@ -588,6 +596,14 @@ class NetmaskTestMixin_v6(CommonTestMixin_v6):
assertBadNetmask
(
"::1"
,
"pudding"
)
assertBadNetmask
(
"::"
,
"::"
)
def
test_netmask_in_tuple_errors
(
self
):
def
assertBadNetmask
(
addr
,
netmask
):
msg
=
"
%
r is not a valid netmask"
%
netmask
with
self
.
assertNetmaskError
(
re
.
escape
(
msg
)):
self
.
factory
((
addr
,
netmask
))
assertBadNetmask
(
"::1"
,
-
1
)
assertBadNetmask
(
"::1"
,
129
)
def
test_pickle
(
self
):
self
.
pickle_test
(
'2001:db8::1000/124'
)
self
.
pickle_test
(
'2001:db8::1000/127'
)
# IPV6LENGTH - 1
...
...
Misc/ACKS
Dosyayı görüntüle @
5e48e3db
...
...
@@ -1108,6 +1108,7 @@ Bastien Montagne
Skip Montanaro
Peter Moody
Alan D. Moore
Nicolai Moore
Paul Moore
Ross Moore
Ben Morgan
...
...
Misc/NEWS.d/next/Library/2019-05-14-07-57-02.bpo-36845._GtFFf.rst
0 → 100644
Dosyayı görüntüle @
5e48e3db
Added validation of integer prefixes to the construction of IP networks and
interfaces in the ipaddress module.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment