Skip to content

Define checked conversion and bounds-safe indexing policy #39

Open

Description

@mgradwohl
No description provided.

Activity

  1. mgradwohl commented on Feb 27, 2023

    @mgradwohl
    OwnerAuthor

    If wil has an equivalent to gsl::at this would reduce the dependencies.

    https://github.com/microsoft/wil/wiki/safe_cast
    and
    https://github.com/Microsoft/wil/blob/master/include/wil/safecast.h

  2. changed the title [-]investigate wil::safe_cast vs gsl::narrow_cast[/-] [+]investigate wil::safe_cast vs gsl::narrow_cast and wil equivalent of gsl::at[/+] on Feb 27, 2023
  3. mgradwohl commented on Nov 9, 2026

    @mgradwohl
    OwnerAuthor

    Backlog triage

    Status: Still open.
    Severity: low. Priority: med. Impact: maintenance.
    Assessed against fdf20b4cbfbbb8009d45296f3d60f0f541ee539b.

    Evidence

    Shape.cpp:70-91 still narrows dimensions before validation; Renderer.cpp:84-89 narrows hit-test coordinates; Board.h:50-63 relies on flattened vector::at. No documented choice of checked conversion/indexing policy is present.

    Disposition and remaining scope

    The investigation has not been resolved into a safe, consistent policy. gsl::narrow_cast is intentionally unchecked, and vector::at does not validate two-dimensional coordinates. Keep this as a cross-cutting design task; the concrete crash/corruption fixes are #16 and #54 and should be fixed first, not hidden behind a mechanical helper replacement.

    Completion criteria

    • Distinguish proven-safe casts from user/file-derived checked conversions.
    • Evaluate the actual failure semantics of any WIL/GSL helper before adopting it.
    • Validate arithmetic and ranges before narrowing, and validate both grid axes before flattening.
    • Document the chosen exception/result/fail-fast policy and add boundary tests; avoid renaming casts without adding checks.
  4. changed the title [-]investigate wil::safe_cast vs gsl::narrow_cast and wil equivalent of gsl::at[/-] [+]Define checked conversion and bounds-safe indexing policy[/+] on Nov 9, 2026
  5. added
    enhancementNew feature or request
    severity: lowLimited impact, maintenance improvement, or optional new capability
    priority: medFix next: reliability, maintainability, and high-value usability
    on Nov 9, 2026
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

    enhancementNew feature or requestimpact: maintenanceReview impact category: maintenancepriority: medFix next: reliability, maintainability, and high-value usabilityseverity: lowLimited impact, maintenance improvement, or optional new capability

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions