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
d4367c24
Kaydet (Commit)
d4367c24
authored
Eki 17, 2010
tarafından
Matthias Klose
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Merge r81080 from the python2.6 branch:
Issue #8674: fix another bogus overflow check in audioop module.
üst
192b714f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
17 deletions
+8
-17
audioop.c
Modules/audioop.c
+8
-17
No files found.
Modules/audioop.c
Dosyayı görüntüle @
d4367c24
...
@@ -1150,25 +1150,16 @@ audioop_ratecv(PyObject *self, PyObject *args)
...
@@ -1150,25 +1150,16 @@ audioop_ratecv(PyObject *self, PyObject *args)
ceiling(len*outrate/inrate) output frames, and each frame
ceiling(len*outrate/inrate) output frames, and each frame
requires bytes_per_frame bytes. Computing this
requires bytes_per_frame bytes. Computing this
without spurious overflow is the challenge; we can
without spurious overflow is the challenge; we can
settle for a reasonable upper bound, though. */
settle for a reasonable upper bound, though, in this
int
ceiling
;
/* the number of output frames */
case ceiling(len/inrate) * outrate. */
int
nbytes
;
/* the number of output bytes needed */
int
q
=
len
/
inrate
;
/* compute ceiling(len/inrate) without overflow */
/* Now len = q * inrate + r exactly (with r = len % inrate),
int
q
=
len
>
0
?
1
+
(
len
-
1
)
/
inrate
:
0
;
and this is less than q * inrate + inrate = (q+1)*inrate.
if
(
outrate
>
INT_MAX
/
q
/
bytes_per_frame
)
So a reasonable upper bound on len*outrate/inrate is
((q+1)*inrate)*outrate/inrate =
(q+1)*outrate.
*/
ceiling
=
(
q
+
1
)
*
outrate
;
nbytes
=
ceiling
*
bytes_per_frame
;
/* See whether anything overflowed; if not, get the space. */
if
(
q
+
1
<
0
||
ceiling
/
outrate
!=
q
+
1
||
nbytes
/
bytes_per_frame
!=
ceiling
)
str
=
NULL
;
str
=
NULL
;
else
else
str
=
PyString_FromStringAndSize
(
NULL
,
nbytes
);
str
=
PyString_FromStringAndSize
(
NULL
,
q
*
outrate
*
bytes_per_frame
);
if
(
str
==
NULL
)
{
if
(
str
==
NULL
)
{
PyErr_SetString
(
PyExc_MemoryError
,
PyErr_SetString
(
PyExc_MemoryError
,
...
...
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