Backport double-free / use-after-free fix from upstream

8d93fe0718

ok jca@
This commit is contained in:
chrisz 2019-05-02 12:49:25 +00:00
parent 98a04ce651
commit 1fe8c3b1bc
2 changed files with 17 additions and 3 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.5 2018/12/28 17:32:36 jca Exp $
# $OpenBSD: Makefile,v 1.6 2019/05/02 12:49:25 chrisz Exp $
COMMENT = Symas Lightning Memory-Mapped Database
VERSION = 0.9.23
REVISION = 0
GH_ACCOUNT = LMDB
GH_PROJECT = lmdb

View File

@ -1,10 +1,23 @@
$OpenBSD: patch-mdb_c,v 1.4 2018/12/28 17:32:36 jca Exp $
$OpenBSD: patch-mdb_c,v 1.5 2019/05/02 12:49:25 chrisz Exp $
UBC (no Unified Buffer Cache).
backport ITS#9007 don't free loose writemap pages.
enforce MDB_WRITEMAP, because we have no UBC (Unified Buffer Cache).
Index: mdb.c
--- mdb.c.orig
+++ mdb.c
@@ -3109,9 +3109,9 @@ mdb_freelist_save(MDB_txn *txn)
} else {
x = mdb_mid2l_search(dl, mp->mp_pgno);
mdb_tassert(txn, dl[x].mid == mp->mp_pgno);
+ mdb_dpage_free(env, mp);
}
dl[x].mptr = NULL;
- mdb_dpage_free(env, mp);
}
{
/* squash freed slots out of the dirty list */
@@ -4968,6 +4968,7 @@ mdb_env_open(MDB_env *env, const char *path, unsigned
/* silently ignore WRITEMAP when we're only getting read access */
flags &= ~MDB_WRITEMAP;