[Patches] segmentation fault when trying to read from a close (fwd) ()d gdbm database (PR#198)

Guido van Rossum guido@python.org
Mon, 07 Feb 2000 11:11:21 -0500


Not sure if this is appropriate to forward here; but seems easy to
fix and worth it.

--Guido van Rossum (home page: http://www.python.org/~guido/)

------- Forwarded Message

Date:    Mon, 07 Feb 2000 05:13:08 -0500
From:    bhaddow@orbism.com
To:      python-bugs-list@python.org
cc:      bugs-py@python.org
Subject: [Python-bugs-list] segmentation fault when trying to read from a close
	  ()d gdbm database (PR#198)

Full_Name: Barry Haddow
Version: 1.52
OS: Linux (RedHat 6.0)
Submission from: p868.as1.adl.dublin.eircom.net (159.134.231.100)


Hi


Running the following causes a segmentation fault.

#/usr/bin/env python

import gdbm

db = gdbm.open('db','n')
db['name'] = 'barry'
db.close()
print db['name']

The problem can be fixed by editing the function dbm_subscript()
in Modules/gdbmmodule.c , line 148. A check should be added to ensure
that the database is not already closed, as in lines 182-184 of dbm_ass_sub().

cheers
Barry



_______________________________________________
Python-bugs-list maillist  -  Python-bugs-list@python.org
http://www.python.org/mailman/listinfo/python-bugs-list

------- End of Forwarded Message