This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: invalid check of _bsddb creation failure
Type: crash Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jcea Nosy List: jcea, vstinner
Priority: normal Keywords: patch

Created on 2008-07-06 22:56 by vstinner, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
bsddb_create.patch vstinner, 2008-07-06 22:55 Proposition to fix the bug
Messages (3)
msg69358 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2008-07-06 22:55
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).
msg69359 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2008-07-06 22:59
The bug occurs on db_create() failure. Dummy example to reproduce it:
"import _bsddb; _bsddb.DB(None, 29.515)"
msg70008 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2008-07-19 09:37
Solved in my SVN repository. Revision 527. Testsuite updated.

Will be available in bsddb 4.7.2.
History
Date User Action Args
2022-04-11 14:56:36adminsetgithub: 47557
2008-07-19 09:37:50jceasetresolution: fixed
2008-07-19 09:37:05jceasetstatus: open -> closed
messages: + msg70008
2008-07-07 04:36:19gregory.p.smithsetpriority: normal
assignee: jcea
type: crash
nosy: + jcea
2008-07-06 22:59:13vstinnersetmessages: + msg69359
2008-07-06 22:56:00vstinnercreate