Skip to content

select_winners: use saturating arithmetic for the anchor index (Scout finding) #134

Description

@0xdevcollins

Source: docs/threat-model.md v1.0, Tamp.7 (planned hardening). Scout re-scan S-1.

contracts/events/src/event_ops.rs:745: let anchor_idx = existing_count + (idx as u32); is the one bare addition left in the contract. Unreachable in practice (2³² winner records) and it traps under overflow-checks = true, but it breaks the checked-arithmetic rule adopted for the earlier Scout findings.

  • existing_count.saturating_add(idx as u32)
  • Re-run Scout (see docs/scout-audit-report.md for the SDK 23.5 workaround) and confirm the finding is gone

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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions