mirror of
https://github.com/isar/libmdbx.git
synced 2024-10-30 23:39:19 +08:00
mdbx: add error-logging to mdbx_page_get().
Change-Id: I6a1a95ec6fc73aa7bf28875a89b1dd6c02ef5164
This commit is contained in:
parent
7a3c8743f3
commit
0f82db941b
11
src/mdbx.c
11
src/mdbx.c
@ -6927,13 +6927,20 @@ mapped:
|
|||||||
p = pgno2page(env, pgno);
|
p = pgno2page(env, pgno);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (unlikely(p->mp_pgno != pgno))
|
if (unlikely(p->mp_pgno != pgno)) {
|
||||||
|
mdbx_error("mismatch pgno %" PRIaPGNO " (actual) != %" PRIaPGNO
|
||||||
|
" (expected)",
|
||||||
|
p->mp_pgno, pgno);
|
||||||
return MDBX_CORRUPTED;
|
return MDBX_CORRUPTED;
|
||||||
|
}
|
||||||
|
|
||||||
if (unlikely(p->mp_upper < p->mp_lower ||
|
if (unlikely(p->mp_upper < p->mp_lower ||
|
||||||
PAGEHDRSZ + p->mp_upper > env->me_psize) &&
|
PAGEHDRSZ + p->mp_upper > env->me_psize) &&
|
||||||
!IS_OVERFLOW(p))
|
!IS_OVERFLOW(p)) {
|
||||||
|
mdbx_error("invalid page lower(%u)/upper(%u), pg-limit %u", p->mp_lower,
|
||||||
|
p->mp_upper, env->me_psize - PAGEHDRSZ);
|
||||||
return MDBX_CORRUPTED;
|
return MDBX_CORRUPTED;
|
||||||
|
}
|
||||||
/* TODO: more checks here, including p->mp_validator */
|
/* TODO: more checks here, including p->mp_validator */
|
||||||
|
|
||||||
*ret = p;
|
*ret = p;
|
||||||
|
Loading…
Reference in New Issue
Block a user