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
7cac1c25
Kaydet (Commit)
7cac1c25
authored
Mar 03, 2013
tarafından
Mark Dickinson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #16445: Fix potential segmentation fault when deleting an exception message.
üst
ff0deb05
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
test_exceptions.py
Lib/test/test_exceptions.py
+12
-0
NEWS
Misc/NEWS
+3
-0
exceptions.c
Objects/exceptions.c
+1
-2
No files found.
Lib/test/test_exceptions.py
Dosyayı görüntüle @
7cac1c25
...
@@ -479,6 +479,18 @@ class ExceptionTests(unittest.TestCase):
...
@@ -479,6 +479,18 @@ class ExceptionTests(unittest.TestCase):
except
AssertionError
as
e
:
except
AssertionError
as
e
:
self
.
assertEqual
(
str
(
e
),
"(3,)"
)
self
.
assertEqual
(
str
(
e
),
"(3,)"
)
def
test_bad_exception_clearing
(
self
):
# See issue 16445: use of Py_XDECREF instead of Py_CLEAR in
# BaseException_set_message gave a possible way to segfault the
# interpreter.
class
Nasty
(
str
):
def
__del__
(
message
):
del
e
.
message
e
=
ValueError
(
Nasty
(
"msg"
))
e
.
args
=
()
del
e
.
message
# Helper class used by TestSameStrAndUnicodeMsg
# Helper class used by TestSameStrAndUnicodeMsg
class
ExcWithOverriddenStr
(
Exception
):
class
ExcWithOverriddenStr
(
Exception
):
...
...
Misc/NEWS
Dosyayı görüntüle @
7cac1c25
...
@@ -9,6 +9,9 @@ What's New in Python 2.7.4
...
@@ -9,6 +9,9 @@ What's New in Python 2.7.4
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #16445: Fixed potential segmentation fault when deleting an exception
message.
- Issue #17275: Corrected class name in init error messages of the C version of
- Issue #17275: Corrected class name in init error messages of the C version of
BufferedWriter and BufferedRandom.
BufferedWriter and BufferedRandom.
...
...
Objects/exceptions.c
Dosyayı görüntüle @
7cac1c25
...
@@ -349,8 +349,7 @@ BaseException_set_message(PyBaseExceptionObject *self, PyObject *val)
...
@@ -349,8 +349,7 @@ BaseException_set_message(PyBaseExceptionObject *self, PyObject *val)
if
(
PyDict_DelItemString
(
self
->
dict
,
"message"
)
<
0
)
if
(
PyDict_DelItemString
(
self
->
dict
,
"message"
)
<
0
)
return
-
1
;
return
-
1
;
}
}
Py_XDECREF
(
self
->
message
);
Py_CLEAR
(
self
->
message
);
self
->
message
=
NULL
;
return
0
;
return
0
;
}
}
...
...
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