mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-06 18:54:14 +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);
|
MDB_meta *meta = mdbx_meta_head(env);
|
||||||
txn->mt_canary = meta->mm_canary;
|
txn->mt_canary = meta->mm_canary;
|
||||||
txn->mt_txnid = meta->mm_txnid + 1;
|
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;
|
txn->mt_flags = flags;
|
||||||
|
|
||||||
#if MDB_DEBUG
|
#if MDB_DEBUG
|
||||||
@ -2262,6 +2268,7 @@ static int mdbx_txn_renew0(MDB_txn *txn, unsigned flags) {
|
|||||||
} else {
|
} else {
|
||||||
return MDB_SUCCESS;
|
return MDB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
bailout:
|
||||||
assert(rc != MDB_SUCCESS);
|
assert(rc != MDB_SUCCESS);
|
||||||
mdbx_txn_end(txn, MDB_END_SLOT | MDB_END_FAIL_BEGIN);
|
mdbx_txn_end(txn, MDB_END_SLOT | MDB_END_FAIL_BEGIN);
|
||||||
return rc;
|
return rc;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user