From 0f1081449431cf0c2b4a00c1b742958f13cdb253 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 3 Apr 2012 12:24:27 -0700 Subject: [PATCH] ITS#7219 fix for odd-aligned keys in mdb_update_key() --- libraries/libmdb/mdb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c index 7129d0a1bc..6952d884e3 100644 --- a/libraries/libmdb/mdb.c +++ b/libraries/libmdb/mdb.c @@ -5054,11 +5054,11 @@ mdb_cursor_dbi(MDB_cursor *mc) static int mdb_update_key(MDB_page *mp, indx_t indx, MDB_val *key) { - indx_t ptr, i, numkeys; - int delta; - size_t len; MDB_node *node; char *base; + size_t len; + int delta; + indx_t ptr, i, numkeys; DKBUF; node = NODEPTR(mp, indx); @@ -5078,6 +5078,7 @@ mdb_update_key(MDB_page *mp, indx_t indx, MDB_val *key) #endif delta = key->mv_size - node->mn_ksize; + delta += (delta & 1); if (delta) { if (delta > 0 && SIZELEFT(mp) < delta) { DPRINTF("OUCH! Not enough room, delta = %d", delta); -- 2.39.5