[Python-checkins] cpython (3.3): Check return value of PyObject_AsFileDescriptor() in _Py_DisplaySourceLine()
christian.heimes
python-checkins at python.org
Sun Jul 21 01:55:20 CEST 2013
http://hg.python.org/cpython/rev/82e9a9f8be3c
changeset: 84750:82e9a9f8be3c
branch: 3.3
parent: 84745:8b8673ccd3d1
user: Christian Heimes <christian at cheimes.de>
date: Sun Jul 21 01:53:10 2013 +0200
summary:
Check return value of PyObject_AsFileDescriptor() in _Py_DisplaySourceLine() for error
CID 486768
files:
Python/traceback.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/Python/traceback.c b/Python/traceback.c
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -255,6 +255,11 @@
/* use the right encoding to decode the file as unicode */
fd = PyObject_AsFileDescriptor(binary);
+ if (fd < 0) {
+ Py_DECREF(io);
+ Py_DECREF(binary);
+ return NULL;
+ }
found_encoding = PyTokenizer_FindEncodingFilename(fd, filename);
encoding = (found_encoding != NULL) ? found_encoding : "utf-8";
lseek(fd, 0, 0); /* Reset position */
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list