From ee899a21ed2e43fe8856542798d5b6377307318c Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Tue, 5 Mar 2019 17:55:33 +0300 Subject: [PATCH] mdbx: treat pagesize == 0/INTPTR_MAX as aliases for MIN_PAGESIZE/MAX_PAGESIZE. --- src/mdbx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mdbx.c b/src/mdbx.c index 22beeb5c..a3342f9d 100644 --- a/src/mdbx.c +++ b/src/mdbx.c @@ -5723,6 +5723,11 @@ LIBMDBX_API int mdbx_env_set_geometry(MDBX_env *env, intptr_t size_lower, } } + if (pagesize == 0) + pagesize = MIN_PAGESIZE; + else if (pagesize == INTPTR_MAX) + pagesize = MAX_PAGESIZE; + if (pagesize < (intptr_t)MIN_PAGESIZE || pagesize > (intptr_t)MAX_PAGESIZE || !mdbx_is_power2(pagesize)) { rc = MDBX_EINVAL;