<!-- XE-16837 · [Low] MemStore GetPendingPage panics on negative offset · testnet -->
*Markdown view of <https://bounty.xe.network/XE-16837>. The page is the record; this is the same page for reading.*

XE-16837 · Bounty

# \[Low\] MemStore GetPendingPage panics on negative offset

Closed · duplicate
—
[xe#666](https://github.com/xeprotocol/xe/issues/666)
filed 2026-11-17 06:31 UTC
by kecedanzz77-bit

Verdict
:   Duplicate

Tier
:   —

Claimed
:   —

Area
:   Node / API

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-22 23:26 UTC

Told
:   2026-11-22 23:26 UTC

### Patches

None linked.

### History

- [770260](https://bounty.xe.network/log/770260) 2026-11-22 23:26 UTC reply.mirror\_failed
- [769885](https://bounty.xe.network/log/769885) 2026-11-22 23:26 UTC proposal.adopted
- [769884](https://bounty.xe.network/log/769884) 2026-11-22 23:26 UTC reply.sent
- [769883](https://bounty.xe.network/log/769883) 2026-11-22 23:26 UTC proposal.adopted
- [769882](https://bounty.xe.network/log/769882) 2026-11-22 23:26 UTC ticket.status new → closed
- [768861](https://bounty.xe.network/log/768861) 2026-11-22 23:25 UTC proposal.adopted
- [768860](https://bounty.xe.network/log/768860) 2026-11-22 23:25 UTC ticket.facts area
- [768859](https://bounty.xe.network/log/768859) 2026-11-22 23:25 UTC proposal.adopted
- [768858](https://bounty.xe.network/log/768858) 2026-11-22 23:25 UTC ticket.facts
- [768857](https://bounty.xe.network/log/768857) 2026-11-22 23:25 UTC proposal.adopted
- [768856](https://bounty.xe.network/log/768856) 2026-11-22 23:25 UTC ticket.facts
- [766585](https://bounty.xe.network/log/766585) 2026-11-22 23:17 UTC note.added

[Full history](https://bounty.xe.network/log?ref=XE-16837) · [JSON](https://bounty.xe.network/v1/tickets/XE-16837) · [markdown](https://bounty.xe.network/XE-16837.md)

### Report

## Summary

`MemStore.GetPendingPage` panics on a negative offset: the page loop indexes the sorted hash slice starting at `offset` with no lower-bound check. BadgerStore handles the same call by returning from the start.

## Root cause

`store/mem_store.go` `GetPendingPage` (`:203-221`): `for i := offset; i < len(hashes) && len(out) < limit; i++ { cp := *m.pending[hashes[i]] ... }` — a negative `offset` indexes `hashes[-1]`.

## Verification

Differential harness, `GetPendingPage(ctx, -1, 10)` with one pending stored:

- MemStore: `PANICKED: runtime error: index out of range [-1]`.
- BadgerStore: page len\=1, `err=<nil>`.

## Impact

Crash of any MemStore-backed node on a negative-offset page request. The API clamps offset \>\= 0 today (`api/handler.go:651`), so this is not API-reachable — a latent robustness bug in a public store method.

## Note on related reports

The only other report mentioning `GetPendingPage` is #648 (full-table scans before pagination) — a different issue.

## Suggested fix

Clamp `offset` to 0, matching BadgerStore.

### Thread

**Joseph Denne**team2026-11-22 23:26 UTCdesk

Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the
first verifiable submission, so this one closes as a duplicate. If you believe it is a different
bug, file a new report that links https://bounty.xe.network/XE-16837 and says what differs; it is read like any other.
