[New-bugs-announce] [issue3307] invalid check of _bsddb creation failure
STINNER Victor
report at bugs.python.org
Mon Jul 7 00:56:01 CEST 2008
New submission from STINNER Victor <haypo at users.sourceforge.net>:
newDBObject(), called by DB_construct(), doesn't check correctly the
result of all to the external function db_create(). It checks if
self->db is NULL, but db_create() doesn't change self->db value on
error. So if self->db is uninitialized, the error is not catched.
Two ideas to fix the bug:
- check "if (err)" instead of "if (self->db != NULL)"
- set self->db=NULL before calling db_create()
I implemented the second proposition in the attached patch.
Note: The bug occurs with PYDEBUG, I don't know if PyObject_New()
fills new allocate memory to zero (I think no, but I'm not sure).
----------
components: Library (Lib)
files: bsddb_create.patch
keywords: patch
messages: 69358
nosy: haypo
severity: normal
status: open
title: invalid check of _bsddb creation failure
versions: Python 2.6
Added file: http://bugs.python.org/file10836/bsddb_create.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3307>
_______________________________________
More information about the New-bugs-announce
mailing list