[issue3662] _fileio._FileIO segfaults
Christian Heimes
report at bugs.python.org
Sun Aug 24 22:06:59 CEST 2008
Christian Heimes <lists at cheimes.de> added the comment:
The FileIO construct segfaults because PyArg_ParseTupleAndKeywords()
sets name to an invalid but non NULL value. PyMem_Free() tries to
deallocate name but fails.
Suggestion: Either appy this patch or change
PyArg_ParseTupleAndKeyword()'s behavior for 'e'.
Index: Modules/_fileio.c
===================================================================
--- Modules/_fileio.c (Revision 66010)
+++ Modules/_fileio.c (Arbeitskopie)
@@ -174,8 +174,10 @@
if (!PyArg_ParseTupleAndKeywords(args, kwds, "et|si:fileio",
kwlist,
Py_FileSystemDefaultEncoding,
- &name, &mode, &closefd))
+ &name, &mode, &closefd)) {
+ name = NULL;
goto error;
+ }
}
}
----------
nosy: +christian.heimes
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3662>
_______________________________________
More information about the Python-bugs-list
mailing list