]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9920 lmdb: fix page offset when converting subpage to real page
authorHoward Chu <hyc@openldap.org>
Wed, 16 Oct 2024 16:36:18 +0000 (17:36 +0100)
committerHoward Chu <hyc@openldap.org>
Wed, 16 Oct 2024 16:36:18 +0000 (17:36 +0100)
offset needs to account for additional space at page tail

libraries/liblmdb/mdb.c

index 8863b6df5ac4b810c3f6683bbf1c2bfb498f168c..0dea5c63f4659da43d3430303f15db444df8dc65 100644 (file)
@@ -8593,7 +8593,7 @@ prep_subDB:
                                        if ((rc = mdb_page_alloc(mc, 1, &mp)))
                                                return rc;
                                        fp_flags |= mp->mp_flags; /* P_ADM_FLAGS */
-                                       offset = env->me_psize - olddata.mv_size;
+                                       offset = env->me_pagespace + PAGEHDRSZ - olddata.mv_size;
                                        flags |= F_DUPDATA|F_SUBDATA;
                                        dummy.md_root = mp->mp_pgno;
                                        sub_root = mp;