mdbx: check comparator for MDBX_GET_BOTH and MDBX_GET_BOTH_RANGE.

This commit is contained in:
Leonid Yuriev 2018-08-24 04:00:59 +03:00 committed by Leo Yuriev
parent f58185afa6
commit e3ff19a722

View File

@ -7264,9 +7264,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;
}