From c499f2bb36a0b15e4034b05902d5bb5a45d13837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Mon, 27 Jun 2022 13:53:22 +0300 Subject: [PATCH] mdbx: minor fix `EINVAL` from `mdbx_env_set_geometry()`. Silently growth `size_lower` to the `MIN_PAGENO` instead of returning `MDBX_EINVAL`. --- src/core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core.c b/src/core.c index 787cb18f..2a123239 100644 --- a/src/core.c +++ b/src/core.c @@ -11796,8 +11796,13 @@ mdbx_env_set_geometry(MDBX_env *env, intptr_t size_lower, intptr_t size_now, } if ((uint64_t)size_lower / pagesize < MIN_PAGENO) { - rc = MDBX_EINVAL; - goto bailout; + size_lower = pagesize * MIN_PAGENO; + if (unlikely(size_lower > size_upper)) { + rc = MDBX_EINVAL; + goto bailout; + } + if (size_now < size_lower) + size_now = size_lower; } if (unlikely((size_t)size_upper > MAX_MAPSIZE ||