Skip to content

Fix crash when user cancels hello dialog - #201

Merged
Soham Das (SohamDas2021) merged 1 commit into
mainfrom
fixCrashOnClosingHelloDialog
Mar 24, 2026
Merged

Soham Das (SohamDas2021) merged 1 commit into
mainfrom
fixCrashOnClosingHelloDialog

Conversation

@SohamDas2021

Copy link
Copy Markdown
Collaborator

Fixes a process crash (FAIL_FAST) that occurs when a user cancels the Windows Hello PIN/biometric dialog during user-bound key operations.
Added a helper function KeyCredentialStatusToHResult() that properly maps KeyCredentialStatus enum values to appropriate failure HRESULTs.
Fixed the same bug for both C++ and Rust implementations.

@SohamDas2021
Soham Das (SohamDas2021) merged commit 569514f into main Mar 24, 2026
19 checks passed
Branden Bonaby (bbonaby) pushed a commit that referenced this pull request Apr 22, 2026
…()) (#202)

When exceptions cross the VTL0/VTL1 boundary, the exception object's
message pointer can become nullptr because VTL0 heap memory is not
accessible from VTL1. Calling std::string(e.what()) or strlen(e.what())
on a nullptr triggers an access violation that fast-fails the host
process.

This was reproducible with HostAppUserBound (Create Key -> Cancel) and
HostAppUserBoundSignVerify (Sign -> Cancel) sample apps.

Fix: Add a safe_what() helper in both userboundkey.vtl1.cpp (3 sites)
and userboundkey.vtl0.cpp (5 sites) that returns a fallback string when
e.what() is nullptr.

Note: This is distinct from the fix in PR #201 which addressed incorrect
HRESULT mapping of KeyCredentialStatus enum values. That fix ensured the
cancel error is reported as a real failure HRESULT; this fix hardens the
catch blocks that log the error before re-throwing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants