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
f6358a7e
Kaydet (Commit)
f6358a7e
authored
Eki 14, 2015
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
_PyBytesWriter_Alloc(): only use 10 bytes of the small buffer in debug mode to
enhance code to detect buffer under- and overflow.
üst
f091033b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
bytesobject.c
Objects/bytesobject.c
+13
-1
No files found.
Objects/bytesobject.c
Dosyayı görüntüle @
f6358a7e
...
...
@@ -4053,8 +4053,20 @@ _PyBytesWriter_Alloc(_PyBytesWriter *writer, Py_ssize_t size)
writer
->
use_small_buffer
=
1
;
#ifdef Py_DEBUG
/* the last byte is reserved, it must be '\0' */
writer
->
allocated
=
sizeof
(
writer
->
small_buffer
)
-
1
;
/* In debug mode, don't use the full small buffer because it is less
efficient than bytes and bytearray objects to detect buffer underflow
and buffer overflow. Use 10 bytes of the small buffer to test also
code using the smaller buffer in debug mode.
Don't modify the _PyBytesWriter structure (use a shorter small buffer)
in debug mode to also be able to detect stack overflow when running
tests in debug mode. The _PyBytesWriter is large (more than 512 bytes),
if Py_EnterRecursiveCall() is not used in deep C callback, we may hit a
stack overflow. */
writer
->
allocated
=
Py_MIN
(
writer
->
allocated
,
10
);
/* _PyBytesWriter_CheckConsistency() requires the last byte to be 0,
to detect buffer overflow */
writer
->
small_buffer
[
writer
->
allocated
]
=
0
;
#else
writer
->
allocated
=
sizeof
(
writer
->
small_buffer
);
...
...
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