mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 01:24:13 +08:00
mdbx: check for txnid overflow (paranoia).
Change-Id: Id7cd62abf8605150ff5491fb1129383e3e748603
This commit is contained in:
parent
9e07b71c27
commit
fd078ee163
@ -2213,6 +2213,12 @@ static int mdbx_txn_renew0(MDB_txn *txn, unsigned flags) {
|
||||
MDB_meta *meta = mdbx_meta_head(env);
|
||||
txn->mt_canary = meta->mm_canary;
|
||||
txn->mt_txnid = meta->mm_txnid + 1;
|
||||
if (unlikely(txn->mt_txnid < meta->mm_txnid)) {
|
||||
mdbx_debug("txnid overflow!");
|
||||
rc = MDB_TXN_FULL;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
txn->mt_flags = flags;
|
||||
|
||||
#if MDB_DEBUG
|
||||
@ -2262,6 +2268,7 @@ static int mdbx_txn_renew0(MDB_txn *txn, unsigned flags) {
|
||||
} else {
|
||||
return MDB_SUCCESS;
|
||||
}
|
||||
bailout:
|
||||
assert(rc != MDB_SUCCESS);
|
||||
mdbx_txn_end(txn, MDB_END_SLOT | MDB_END_FAIL_BEGIN);
|
||||
return rc;
|
||||
|
Loading…
x
Reference in New Issue
Block a user