From c47b1136743a8f11eab299d3beb0134e3060b12f Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 6 Oct 2025 16:49:25 +0100 Subject: [PATCH 1/4] ITS#10396 lmdb: fix mdb_cursor_del0 with multiple DUPSORT cursors Use the correct stack index when adjusting other cursors pointing to the affected page and the DB has a subDB. Broken in ITS#8406. --- libraries/liblmdb/mdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 7a52945c3b..73892c16ea 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -8608,7 +8608,7 @@ mdb_cursor_del0(MDB_cursor *mc) goto fail; } if (m3->mc_xcursor && !(m3->mc_flags & C_EOF)) { - MDB_node *node = NODEPTR(m3->mc_pg[m3->mc_top], m3->mc_ki[m3->mc_top]); + MDB_node *node = NODEPTR(m3->mc_pg[mc->mc_top], m3->mc_ki[mc->mc_top]); /* If this node has dupdata, it may need to be reinited * because its data has moved. * If the xcursor was not initd it must be reinited. From 7259296081845d94bbcd5208ce3de633b1097f2e Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 6 Oct 2025 16:53:18 +0100 Subject: [PATCH 2/4] ITS#10396 fix mdb_cursor_del0 with multiple DUPSORT cursors --- libraries/liblmdb/CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/liblmdb/CHANGES b/libraries/liblmdb/CHANGES index 857a08e14c..64eb2eab4c 100644 --- a/libraries/liblmdb/CHANGES +++ b/libraries/liblmdb/CHANGES @@ -7,6 +7,7 @@ LMDB 0.9.34 Engineering ITS#10342 - fix memleak in mdb_txn_begin for nested txns ITS#10346 - fix mdb_env_copy2 with values > (2GB-16) ITS#10355 - fix mplay build on musl + ITS#10396 - fix mdb_cursor_del0 with multiple DUPSORT cursors LMDB 0.9.33 Release (2024/05/21) ITS#9037 mdb_page_search: fix error code when DBI record is missing From b807ef1345becebf5eca41ac9426742595f8d2d5 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 15 Oct 2025 18:12:26 +0100 Subject: [PATCH 3/4] ITS#9564 lmdb: fix race condition freeing spilled pages at end of transaction --- libraries/liblmdb/mdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 73892c16ea..a6b5375c00 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -3078,6 +3078,7 @@ mdb_txn_end(MDB_txn *txn, unsigned mode) txn->mt_numdbs = 0; txn->mt_flags = MDB_TXN_FINISHED; + mdb_midl_free(txn->mt_spill_pgs); if (!txn->mt_parent) { mdb_midl_shrink(&txn->mt_free_pgs); @@ -3099,7 +3100,6 @@ mdb_txn_end(MDB_txn *txn, unsigned mode) mdb_midl_free(txn->mt_free_pgs); free(txn->mt_u.dirty_list); } - mdb_midl_free(txn->mt_spill_pgs); mdb_midl_free(pghead); } From 270c5438288fa15a03a75400e788734f32a5608d Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 15 Oct 2025 18:13:58 +0100 Subject: [PATCH 4/4] ITS#9564 --- libraries/liblmdb/CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/liblmdb/CHANGES b/libraries/liblmdb/CHANGES index 64eb2eab4c..0606e5d537 100644 --- a/libraries/liblmdb/CHANGES +++ b/libraries/liblmdb/CHANGES @@ -1,6 +1,7 @@ LMDB 0.9 Change Log LMDB 0.9.34 Engineering + ITS#9564 - fix race condition freeing spilled pages at end of transaction ITS#10222 - Update mdb_dump(1) and mdb_load(1) man pages for append (-a) option ITS#10275 - mdb_load: add -Q option to use NOSYNC ITS#10296 - fix fdatasync on MacOS