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
4f5f0e54
Kaydet (Commit)
4f5f0e54
authored
Ock 21, 2013
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #16335: Fix integer overflow in unicode-escape decoder.
üst
410eee56
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
test_ucn.py
Lib/test/test_ucn.py
+16
-0
unicodeobject.c
Objects/unicodeobject.c
+2
-1
No files found.
Lib/test/test_ucn.py
Dosyayı görüntüle @
4f5f0e54
...
@@ -8,6 +8,7 @@ Modified for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com)
...
@@ -8,6 +8,7 @@ Modified for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com)
"""
#"
"""
#"
import
unittest
import
unittest
import
_testcapi
from
test
import
support
from
test
import
support
...
@@ -141,6 +142,21 @@ class UnicodeNamesTest(unittest.TestCase):
...
@@ -141,6 +142,21 @@ class UnicodeNamesTest(unittest.TestCase):
str
,
b
"
\\
NSPACE"
,
'unicode-escape'
,
'strict'
str
,
b
"
\\
NSPACE"
,
'unicode-escape'
,
'strict'
)
)
@unittest.skipUnless
(
_testcapi
.
INT_MAX
<
_testcapi
.
PY_SSIZE_T_MAX
,
"needs UINT_MAX < SIZE_MAX"
)
def
test_issue16335
(
self
):
# very very long bogus character name
try
:
x
=
b
'
\\
N{SPACE'
+
b
'x'
*
(
_testcapi
.
UINT_MAX
+
1
)
+
b
'}'
except
MemoryError
:
raise
unittest
.
SkipTest
(
"not enough memory"
)
self
.
assertEqual
(
len
(
x
),
len
(
b
'
\\
N{SPACE}'
)
+
(
_testcapi
.
UINT_MAX
+
1
))
self
.
assertRaisesRegex
(
UnicodeError
,
'unknown Unicode character name'
,
x
.
decode
,
'unicode-escape'
)
def
test_main
():
def
test_main
():
support
.
run_unittest
(
UnicodeNamesTest
)
support
.
run_unittest
(
UnicodeNamesTest
)
...
...
Objects/unicodeobject.c
Dosyayı görüntüle @
4f5f0e54
...
@@ -3923,7 +3923,8 @@ PyObject *PyUnicode_DecodeUnicodeEscape(const char *s,
...
@@ -3923,7 +3923,8 @@ PyObject *PyUnicode_DecodeUnicodeEscape(const char *s,
/* found a name. look it up in the unicode database */
/* found a name. look it up in the unicode database */
message = "unknown Unicode character name";
message = "unknown Unicode character name";
s++;
s++;
if
(
ucnhash_CAPI
->
getcode
(
NULL
,
start
,
(
int
)(
s
-
start
-
1
),
&
chr
))
if (s - start - 1 <= INT_MAX &&
ucnhash_CAPI->getcode(NULL, start, (int)(s-start-1), &chr))
goto store;
goto store;
}
}
}
}
...
...
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