Skip to content

Large search limits overflow pagination in in-memory, OSS and COS stores #4412

Backlog

Description

@CryoThrust

Problem

InMemoryStore, OssBaseStore and CosBaseStore compute the page end as Math.min(start + limit, size) using int arithmetic. A valid large positive limit such as Integer.MAX_VALUE overflows as soon as a positive offset is used. Even searching beyond the end of a short result set throws instead of returning an empty page.

Reproduction

Store two entries a and b in one namespace, then call search(namespace, Integer.MAX_VALUE, 1). Expected: [b]; actual: an invalid subList range. Reproduced independently against the in-memory store and both object-storage SDK fixtures on main@5a315a9af. All three regressions execute, with zero skips; no cloud credentials or live cloud service is involved.

Proposed scope

Clamp the requested page length to the number of remaining entries before adding it to the start index. Preserve existing listing, key ordering and positive pagination behavior. Add regressions for a large limit, an offset past the last item and ordinary page boundaries across all three affected implementations. No new API, shared abstraction, dependency or cloud storage format changes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions