diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 4a21242..9e4a068 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -6989,6 +6989,9 @@ mdb_cursor_count(MDB_cursor *mc, size_t *countp) if (mc->mc_txn->mt_flags & MDB_TXN_ERROR) return MDB_BAD_TXN; + if (!(mc->mc_flags & C_INITIALIZED)) + return EINVAL; + leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]); if (!F_ISSET(leaf->mn_flags, F_DUPDATA)) { *countp = 1;