Bounty
XE-16837 · Bounty

[Low] MemStore GetPendingPage panics on negative offset

Closed · duplicate — xe#666 filed 2026-11-17 06:31 UTC by kecedanzz77-bit

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 Denneteam2026-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.