{"id":"XE-16837","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"666","source_url":"https://github.com/xeprotocol/xe/issues/666","reporter_id":2920,"title":"[Low] MemStore GetPendingPage panics on negative offset","area":"node-api","claimed_tier":null,"assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"open","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-17T06:33:15.088277+00:00","updated_at":"2026-11-22T23:26:12.936565+00:00","source_created_at":"2026-11-17T06:31:31+00:00","told_at":"2026-11-22T23:26:13.032183+00:00","status_changed_at":"2026-11-22T23:26:12.960831+00:00","url":"https://bounty.xe.network/XE-16837","body":"## Summary\n\n`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.\n\n## Root cause\n\n`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]`.\n\n## Verification\n\nDifferential harness, `GetPendingPage(ctx, -1, 10)` with one pending stored:\n- MemStore: `PANICKED: runtime error: index out of range [-1]`.\n- BadgerStore: page len=1, `err=<nil>`.\n\n## Impact\n\nCrash 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.\n\n## Note on related reports\n\nThe only other report mentioning `GetPendingPage` is #648 (full-table scans before pagination) — a different issue.\n\n## Suggested fix\n\nClamp `offset` to 0, matching BadgerStore.","patch_refs":[],"thread":[{"id":18814,"source":"desk","source_ref":"reply:16491","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-16837 and says what differs; it is read like any other.","created_at":"2026-11-22T23:26:12.936565+00:00"}]}