You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Define checked conversion and bounds-safe indexing policy #39
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
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.
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
Activity
mgradwohl commentedon Feb 27, 2023
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
[-]investigate wil::safe_cast vs gsl::narrow_cast[/-][+]investigate wil::safe_cast vs gsl::narrow_cast and wil equivalent of gsl::at[/+]mgradwohl commentedon Nov 9, 2026
Backlog triage
Status: Still open.
Severity: low. Priority: med. Impact: maintenance.
Assessed against
fdf20b4cbfbbb8009d45296f3d60f0f541ee539b.Evidence
Shape.cpp:70-91still narrows dimensions before validation;Renderer.cpp:84-89narrows hit-test coordinates;Board.h:50-63relies 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_castis 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
[-]investigate wil::safe_cast vs gsl::narrow_cast and wil equivalent of gsl::at[/-][+]Define checked conversion and bounds-safe indexing policy[/+]