From d50fff841031c502dc456b91d697306e483f1c8e Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Wed, 9 Dec 2020 03:50:46 +0300 Subject: [PATCH] mdbx: minor refine `mdbx_page_check()`. Change-Id: I325c20fe042635a0641cc24f5661408f3476139b --- src/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core.c b/src/core.c index f9c1063e..e558c3c5 100644 --- a/src/core.c +++ b/src/core.c @@ -15363,7 +15363,7 @@ static __cold int mdbx_page_check(MDBX_cursor *const mc, if (IS_OVERFLOW(mp)) { if (unlikely(mp->mp_pages < 1 && mp->mp_pages >= MAX_PAGENO / 2)) return bad_page(mp, "invalid overflow n-pages (%u)\n", mp->mp_pages); - if (unlikely(mp->mp_pgno > mc->mc_txn->mt_next_pgno - mp->mp_pages)) + if (unlikely(mp->mp_pgno + mp->mp_pages > mc->mc_txn->mt_next_pgno)) return bad_page(mp, "overflow page beyond (%u) next-pgno\n", mp->mp_pgno + mp->mp_pages); return MDBX_SUCCESS;