[issue3664] Pickler.dump from a badly initialized Pickler segfaults

Christian Heimes report at bugs.python.org
Sun Aug 24 22:44:12 CEST 2008


Christian Heimes <lists at cheimes.de> added the comment:

pickler_write() has no check for self->write_buf == NULL

Suggested patch:
===================================================================
--- Modules/_pickle.c   (Revision 66010)
+++ Modules/_pickle.c   (Arbeitskopie)
@@ -421,6 +421,10 @@
 {
     PyObject *data, *result;

+    if (self->write_buf == NULL) {
+        PyErr_SetString(PyExc_SystemError, "Invalid write buffer");
+        return -1;
+    }
     if (s == NULL) {
         if (!(self->buf_size))
             return 0;

----------
nosy: +christian.heimes

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3664>
_______________________________________


More information about the Python-bugs-list mailing list