mdbx: check page bound inside mdbx_page_get().

Change-Id: I7649c3c65c19013e1b367e7554fbe823ea0511d2
This commit is contained in:
Leo Yuriev 2018-07-25 11:15:03 +03:00
parent 21858201e0
commit 32c63077a4

View File

@ -6352,9 +6352,13 @@ static int mdbx_page_get(MDBX_cursor *mc, pgno_t pgno, MDBX_page **ret,
mapped:
p = pgno2page(env, pgno);
/* TODO: check p->mp_validator here */
done:
if (unlikely(p->mp_upper < p->mp_lower ||
PAGEHDRSZ + p->mp_upper > env->me_psize))
return MDBX_CORRUPTED;
/* TODO: more checks here, including p->mp_validator */
*ret = p;
if (lvl)
*lvl = level;