[New-bugs-announce] [issue12839] zlibmodule cannot handle Z_VERSION_ERROR zlib error

rmtew report at bugs.python.org
Thu Aug 25 07:21:49 CEST 2011


New submission from rmtew <richard.m.tew at gmail.com>:

zlibmodule.c calling inflateInit2 and deflateInit2 will subsequently proceed to crash in the case where these functions return Z_VERSION_ERROR.

zlib implementation note:

When you compile against zlib, several functions (actually macros) like inflateInit2 and deflateInit2 compile the version of zlib you are compiling against into the actual call of the underlying real zlib API function.

Our situation:

We are compiling Python as a static library.  When we link Python against our main project,  it links against the version of zlib used by that main project.  The version numbers are different, and rather than getting a nice exception we get a crash.

Expected result:

Proper error handling in zlibmodule.c, and not crash.  Unhandled errors in zlibmodule.c are passed into the custom function zlib_error which looks at the msg field of the zst struct.  In the case of Z_VERSION_ERROR the msg field is not initialised and a crash will result from use of the nonsense value in msg.

----------
components: None
messages: 142954
nosy: rmtew
priority: normal
severity: normal
status: open
title: zlibmodule cannot handle Z_VERSION_ERROR zlib error
type: crash
versions: Python 2.7, Python 3.2

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


More information about the New-bugs-announce mailing list