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
Fix UB in to_string(Error) for unrecognized error codes (#18554) (#18554)
Summary:
executorch::runtime::to_string(Error) returns const char* via a switch statement with no default case. For unrecognized error codes, the function falls off the end without returning (undefined behavior), which in practice returns nullptr.
The fix:
1. Adds a fallback return "Error::Unknown" after the switch in to_string() (without a default: case, preserving -Wswitch coverage for missing enum values).
2. Adds tests for to_string() covering all 21 enum values and the unknown error code path.
Reviewed By: JacobSzwejbka
Differential Revision: D97662639
Pulled By: alexey-sidnev
0 commit comments