From: Howard Chu Date: Tue, 14 May 2013 23:57:50 +0000 (-0700) Subject: Fix mdb_page_split - nested split X-Git-Tag: OPENLDAP_REL_ENG_2_4_36~64^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7233bc295bb3e40b2758158ae2de6f42516962f8;p=openldap Fix mdb_page_split - nested split If updating a page's separator triggers a split in its parent, we may have missed adjusting the parent's cursor position. --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index dfa87964bc..c09cb0d918 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -6933,6 +6933,17 @@ newsep: } } else { mc->mc_ki[ptop]++; + /* Make sure mc_ki is still valid. + */ + if (mn.mc_pg[ptop] != mc->mc_pg[ptop] && + mc->mc_ki[ptop] >= NUMKEYS(mc->mc_pg[ptop])) { + for (i=0; imc_pg[i] = mn.mc_pg[i]; + mc->mc_ki[i] = mn.mc_ki[i]; + } + mc->mc_pg[ptop] = mn.mc_pg[ptop]; + mc->mc_ki[ptop] = mn.mc_ki[ptop] - 1; + } } /* return tmp page to freelist */