mdbx: add validation for DUPSORT flags.

Change-Id: Id1f3325764fb496413d060ea0468394f7e18ae37
This commit is contained in:
Leonid Yuriev 2018-09-16 18:37:56 +03:00
parent a91eef0c0f
commit 35cf4bb60f

View File

@ -11621,6 +11621,20 @@ int mdbx_dbi_open_ex(MDBX_txn *txn, const char *table_name, unsigned user_flags,
if (unlikely(!txn || !dbi || (user_flags & ~VALID_FLAGS) != 0))
return MDBX_EINVAL;
switch (user_flags &
(MDBX_INTEGERDUP | MDBX_DUPFIXED | MDBX_DUPSORT | MDBX_REVERSEDUP)) {
default:
return MDBX_EINVAL;
case MDBX_DUPSORT:
case MDBX_DUPSORT | MDBX_REVERSEDUP:
case MDBX_DUPSORT | MDBX_DUPFIXED:
case MDBX_DUPSORT | MDBX_DUPFIXED | MDBX_REVERSEDUP:
case MDBX_DUPSORT | MDBX_DUPFIXED | MDBX_INTEGERDUP:
case MDBX_DUPSORT | MDBX_DUPFIXED | MDBX_INTEGERDUP | MDBX_REVERSEDUP:
case 0:
break;
}
if (unlikely(txn->mt_signature != MDBX_MT_SIGNATURE))
return MDBX_EBADSIGN;