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
f18bf6fd
Kaydet (Commit)
f18bf6fd
authored
Ock 04, 2015
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add some overflow checks before multiplying (closes #23165)
üst
47e782a6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
NEWS
Misc/NEWS
+3
-0
fileutils.c
Python/fileutils.c
+13
-3
No files found.
Misc/NEWS
Dosyayı görüntüle @
f18bf6fd
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.2.6?
Core and Builtins
-----------------
- Issue #23165: Perform overflow checks before allocating memory in the
_Py_char2wchar function.
- Issue #19529: Fix a potential crash in converting Unicode objects to wchar_t
when Py_UNICODE is 4 bytes but wchar_t is 2 bytes, for example on AIX.
...
...
Python/fileutils.c
Dosyayı görüntüle @
f18bf6fd
...
...
@@ -169,8 +169,11 @@ decode_ascii_surrogateescape(const char *arg, size_t *size)
wchar_t
*
res
;
unsigned
char
*
in
;
wchar_t
*
out
;
size_t
argsize
=
strlen
(
arg
)
+
1
;
res
=
PyMem_Malloc
((
strlen
(
arg
)
+
1
)
*
sizeof
(
wchar_t
));
if
(
argsize
>
PY_SSIZE_T_MAX
/
sizeof
(
wchar_t
))
return
NULL
;
res
=
PyMem_Malloc
(
argsize
*
sizeof
(
wchar_t
));
if
(
!
res
)
return
NULL
;
...
...
@@ -250,10 +253,15 @@ _Py_char2wchar(const char* arg, size_t *size)
argsize
=
mbstowcs
(
NULL
,
arg
,
0
);
#endif
if
(
argsize
!=
(
size_t
)
-
1
)
{
res
=
(
wchar_t
*
)
PyMem_Malloc
((
argsize
+
1
)
*
sizeof
(
wchar_t
));
if
(
argsize
==
PY_SSIZE_T_MAX
)
goto
oom
;
argsize
+=
1
;
if
(
argsize
>
PY_SSIZE_T_MAX
/
sizeof
(
wchar_t
))
goto
oom
;
res
=
(
wchar_t
*
)
PyMem_Malloc
(
argsize
*
sizeof
(
wchar_t
));
if
(
!
res
)
goto
oom
;
count
=
mbstowcs
(
res
,
arg
,
argsize
+
1
);
count
=
mbstowcs
(
res
,
arg
,
argsize
);
if
(
count
!=
(
size_t
)
-
1
)
{
wchar_t
*
tmp
;
/* Only use the result if it contains no
...
...
@@ -276,6 +284,8 @@ _Py_char2wchar(const char* arg, size_t *size)
/* Overallocate; as multi-byte characters are in the argument, the
actual output could use less memory. */
argsize
=
strlen
(
arg
)
+
1
;
if
(
argsize
>
PY_SSIZE_T_MAX
/
sizeof
(
wchar_t
))
goto
oom
;
res
=
(
wchar_t
*
)
PyMem_Malloc
(
argsize
*
sizeof
(
wchar_t
));
if
(
!
res
)
goto
oom
;
...
...
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