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
ea90e0fd
Kaydet (Commit)
ea90e0fd
authored
Kas 21, 2011
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
ctypes check for PyUnicode_GET_SIZE() failure
üst
8ef18872
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
_ctypes.c
Modules/_ctypes/_ctypes.c
+7
-1
cfield.c
Modules/_ctypes/cfield.c
+9
-5
No files found.
Modules/_ctypes/_ctypes.c
Dosyayı görüntüle @
ea90e0fd
...
...
@@ -1142,6 +1142,8 @@ static int
WCharArray_set_value
(
CDataObject
*
self
,
PyObject
*
value
)
{
Py_ssize_t
result
=
0
;
Py_UNICODE
*
wstr
;
Py_ssize_t
len
;
if
(
value
==
NULL
)
{
PyErr_SetString
(
PyExc_TypeError
,
...
...
@@ -1155,7 +1157,11 @@ WCharArray_set_value(CDataObject *self, PyObject *value)
return
-
1
;
}
else
Py_INCREF
(
value
);
if
((
unsigned
)
PyUnicode_GET_SIZE
(
value
)
>
self
->
b_size
/
sizeof
(
wchar_t
))
{
wstr
=
PyUnicode_AsUnicodeAndSize
(
value
,
&
len
);
if
(
wstr
==
NULL
)
return
-
1
;
if
((
unsigned
)
len
>
self
->
b_size
/
sizeof
(
wchar_t
))
{
PyErr_SetString
(
PyExc_ValueError
,
"string too long"
);
result
=
-
1
;
...
...
Modules/_ctypes/cfield.c
Dosyayı görüntüle @
ea90e0fd
...
...
@@ -1259,6 +1259,7 @@ U_get(void *ptr, Py_ssize_t size)
static
PyObject
*
U_set
(
void
*
ptr
,
PyObject
*
value
,
Py_ssize_t
length
)
{
Py_UNICODE
*
wstr
;
Py_ssize_t
size
;
/* It's easier to calculate in characters than in bytes */
...
...
@@ -1271,7 +1272,10 @@ U_set(void *ptr, PyObject *value, Py_ssize_t length)
return
NULL
;
}
else
Py_INCREF
(
value
);
size
=
PyUnicode_GET_SIZE
(
value
);
wstr
=
PyUnicode_AsUnicodeAndSize
(
value
,
&
size
);
if
(
wstr
==
NULL
)
return
NULL
;
if
(
size
>
length
)
{
PyErr_Format
(
PyExc_ValueError
,
"string too long (%zd, maximum length %zd)"
,
...
...
@@ -1471,15 +1475,15 @@ BSTR_set(void *ptr, PyObject *value, Py_ssize_t size)
/* create a BSTR from value */
if
(
value
)
{
Py_ssize_t
size
=
PyUnicode_GET_SIZE
(
value
);
wchar_t
*
wvalue
;
Py_ssize_t
size
;
wvalue
=
PyUnicode_AsUnicodeAndSize
(
value
,
&
size
);
if
(
wvalue
==
NULL
)
return
NULL
;
if
((
unsigned
)
size
!=
size
)
{
PyErr_SetString
(
PyExc_ValueError
,
"String too long for BSTR"
);
return
NULL
;
}
wvalue
=
PyUnicode_AsUnicode
(
value
);
if
(
wvalue
==
NULL
)
return
NULL
;
bstr
=
SysAllocStringLen
(
wvalue
,
(
unsigned
)
size
);
Py_DECREF
(
value
);
}
else
...
...
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