mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noël Rouvignac
13.35.2016 7922522bc5ffbc5830f47d2937aee5d5e70a1573
OPENDJ-2553 Constrain VLV index range queries when evaluating searches without VLV controls

Limited VLVIndex.evaluateNonVLVRequest() to CURSOR_ENTRY_LIMIT maximum:
- size limit are already verified in SearchOperationBasis.returnEntry().
- lookthrough limit and page size are already verified by EntryContainer.searchIndexed() and searchNotIndexed().

VLVIndex.java:
In evaluateNonVLVRequest(), when the count is bigger than CURSOR_ENTRY_LIMIT abort by returning null.
1 files modified
8 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java 8 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java
@@ -28,6 +28,7 @@
import static org.opends.messages.BackendMessages.*;
import static org.opends.server.backends.pluggable.EntryIDSet.*;
import static org.opends.server.backends.pluggable.IndexFilter.*;
import static org.opends.server.util.StaticUtils.*;
import java.io.Closeable;
@@ -507,11 +508,16 @@
  private EntryIDSet evaluateNonVLVRequest(final ReadableTransaction txn, final StringBuilder debugBuilder)
  {
    // prevents creating a very large long array holding all the entries stored in the VLV index (see readRange())
    final int entryCount = getEntryCount(txn);
    if (entryCount <= CURSOR_ENTRY_LIMIT)
    {
    try (Cursor<ByteString, ByteString> cursor = txn.openCursor(getName()))
    {
      if (cursor.next())
      {
        return newDefinedSet(readRange(cursor, getEntryCount(txn), debugBuilder));
          return newDefinedSet(readRange(cursor, entryCount, debugBuilder));
        }
      }
    }
    return null;