]> granicus.if.org Git - python/commitdiff
Backport 53901 and 53902 to prevent crash when there is an error decoding unicode...
authorNeal Norwitz <nnorwitz@gmail.com>
Sun, 25 Feb 2007 16:19:21 +0000 (16:19 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sun, 25 Feb 2007 16:19:21 +0000 (16:19 +0000)
Misc/NEWS
Python/ceval.c

index 92c7e7c06175cacc6c87d08d3cb70676b9489357..9a46c4255d3609c33daca1666c816a27e2c10fdd 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -124,6 +124,8 @@ Extension Modules
 
 - The version number of the ctypes package was changed to "1.0.2".
 
+- Bug #1664966: Fix crash in exec if Unicode filename can't be decoded.
+
 - Patch #1544279: Improve thread-safety of the socket module by moving
   the sock_addr_t storage out of the socket object.
 
index 7884051ffb6f68927f73187993caf0df5363d97e..1ee0f3b603986138b98682f80d4d322ee8118d9f 100644 (file)
@@ -4173,6 +4173,8 @@ exec_statement(PyFrameObject *f, PyObject *prog, PyObject *globals,
                FILE *fp = PyFile_AsFile(prog);
                char *name = PyString_AsString(PyFile_Name(prog));
                PyCompilerFlags cf;
+               if (name == NULL)
+                       return -1;
                cf.cf_flags = 0;
                if (PyEval_MergeCompilerFlags(&cf))
                        v = PyRun_FileFlags(fp, name, Py_file_input, globals,