diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2004-12-28 20:10:48 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2004-12-28 20:10:48 (GMT) |
commit | 3b585b30c04489f869098e5769105c7319d211c1 (patch) | |
tree | 1f668245d7b27349054c38a8d052841f8df98b37 /Modules/zlibmodule.c | |
parent | 078824e4f67a770d8a92d547e6a52d45843f900c (diff) | |
download | cpython-3b585b30c04489f869098e5769105c7319d211c1.zip cpython-3b585b30c04489f869098e5769105c7319d211c1.tar.gz cpython-3b585b30c04489f869098e5769105c7319d211c1.tar.bz2 |
[Bug #1083110] calling .flush() on decompress objects causes a segfault due to an uninitialized pointer: fixes the problem and adds a test case
Diffstat (limited to 'Modules/zlibmodule.c')
-rw-r--r-- | Modules/zlibmodule.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index 7fedae7..c3238a0 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -301,6 +301,8 @@ PyZlib_compressobj(PyObject *selfptr, PyObject *args) return(NULL); self->zst.zalloc = (alloc_func)NULL; self->zst.zfree = (free_func)Z_NULL; + self->zst.next_in = NULL; + self->zst.avail_in = 0; err = deflateInit2(&self->zst, level, method, wbits, memLevel, strategy); switch(err) { case (Z_OK): @@ -335,6 +337,8 @@ PyZlib_decompressobj(PyObject *selfptr, PyObject *args) return(NULL); self->zst.zalloc = (alloc_func)NULL; self->zst.zfree = (free_func)Z_NULL; + self->zst.next_in = NULL; + self->zst.avail_in = 0; err = inflateInit2(&self->zst, wbits); switch(err) { case (Z_OK): @@ -516,7 +520,7 @@ PyZlib_objdecompress(compobject *self, PyObject *args) Py_END_ALLOW_THREADS } - /* Not all of the compressed data could be accomodated in the output buffer + /* Not all of the compressed data could be accommodated in the output buffer of specified size. Return the unconsumed tail in an attribute.*/ if(max_length) { Py_DECREF(self->unconsumed_tail); |