From 6d438605dd0d7bf3947e49a6e98b33115460dbd1 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Fri, 24 Aug 2018 04:00:59 +0300 Subject: [PATCH] mdbx: backport - check comparator for MDBX_GET_BOTH and MDBX_GET_BOTH_RANGE. --- src/mdbx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mdbx.c b/src/mdbx.c index d1567925..ea2c6619 100644 --- a/src/mdbx.c +++ b/src/mdbx.c @@ -7130,9 +7130,11 @@ set1: MDBX_val olddata; if (unlikely((rc = mdbx_node_read(mc, leaf, &olddata)) != MDBX_SUCCESS)) return rc; + if (unlikely(mc->mc_dbx->md_dcmp == NULL)) + return MDBX_EINVAL; rc = mc->mc_dbx->md_dcmp(data, &olddata); if (rc) { - if (op == MDBX_GET_BOTH || rc > 0) + if (op != MDBX_GET_BOTH_RANGE || rc > 0) return MDBX_NOTFOUND; rc = 0; }