mirror of
https://github.com/isar/libmdbx.git
synced 2025-02-01 06:38:22 +08:00
mdbx: add validation for DUPSORT flags.
Change-Id: Id1f3325764fb496413d060ea0468394f7e18ae37
This commit is contained in:
parent
a91eef0c0f
commit
35cf4bb60f
14
src/mdbx.c
14
src/mdbx.c
@ -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))
|
if (unlikely(!txn || !dbi || (user_flags & ~VALID_FLAGS) != 0))
|
||||||
return MDBX_EINVAL;
|
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))
|
if (unlikely(txn->mt_signature != MDBX_MT_SIGNATURE))
|
||||||
return MDBX_EBADSIGN;
|
return MDBX_EBADSIGN;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user