diff options
-rw-r--r-- | cpp/src/Freeze/EvictorIteratorI.cpp | 6 | ||||
-rw-r--r-- | cpp/src/Freeze/IndexI.cpp | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/cpp/src/Freeze/EvictorIteratorI.cpp b/cpp/src/Freeze/EvictorIteratorI.cpp index c82b9eb4af8..d85c1fffe46 100644 --- a/cpp/src/Freeze/EvictorIteratorI.cpp +++ b/cpp/src/Freeze/EvictorIteratorI.cpp @@ -121,6 +121,12 @@ Freeze::EvictorIteratorI::nextBatch() { try { + // + // It is critical to set key size to key capacity before the + // get, as a resize that increases the size inserts 0 + // + _key.resize(_key.capacity()); + _more = (dbc->get(&dbKey, &dbValue, flags) == 0); if(_more) { diff --git a/cpp/src/Freeze/IndexI.cpp b/cpp/src/Freeze/IndexI.cpp index 5e2ecca89c7..0bef0002e7a 100644 --- a/cpp/src/Freeze/IndexI.cpp +++ b/cpp/src/Freeze/IndexI.cpp @@ -82,6 +82,12 @@ Freeze::IndexI::untypedFindFirst(const Key& bytes, Int firstN) const { try { + // + // It is critical to set key size to key capacity before the + // get, as a resize that increases the size inserts 0 + // + pkey.resize(pkey.capacity()); + found = (dbc->pget(&dbKey, &pdbKey, &dbValue, flags) == 0); if(found) { |