[pybsddb] Issue in DBEnv_memp_stat
Rishin Goswami -X (rishigos - WIPRO LIMITED at Cisco)
rishigos at cisco.com
Thu Dec 12 07:42:57 CET 2024
Hello,
I could not find any issue-tracker for the https://pypi.org/project/berkeleydb/ project, so I am communicating about a bug in this mailing list. If there is an issue-tracker, please let me know and I will raise it there.
The issue is in the `DBEnv_memp_stat` function. When calling the `memp_stat`function, we are expecting that the value of `fsp` variable is non NULL. However as per the official documentation, `fsp` can be NULL when "If no individual files currently exist in the cache". For example when `db_env_create` has been done, but we have not yet done a `db_create` followed by a `db->open`. This will cause a NULL pointer reference when looping over `fsp` further down the code and causes a crash.
The following program reproduces the issue -
```
def run():
# Create env
env = db.DBEnv(0)
eflags = db.DB_CREATE | db.DB_INIT_MPOOL
env.open('/some/path/to/dbenv', flags=eflags)
# Don't create a db yet
#x = db.DB(env)
#x.open('mydb_from_py.db', flags=db.DB_CREATE, dbtype=db.DB_BTREE)
# memp state
print(env.memp_stat())
```
Please let me know how this issue will be handled.
Regards,
Rishin Goswami
`
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.jcea.es/pipermail/pybsddb/attachments/20241212/d0f19501/attachment.htm>
More information about the pybsddb
mailing list