-
Notifications
You must be signed in to change notification settings - Fork 829
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(runtime-c-api) Avoid undefined behavior with user-given version.
When the version has type `Version`, we expect the user to give a valid `Version` variant. Since the `Version` is basically a `uint8_t`, the user is able to pass everything she wants, which can create an undefined behavior on the Rust side. To avoid such situation, the version has now type `c_uchar` (`unsigned char` or `uint8_t` on C side —on most platforms). Then the `From` trait is implemented on `Version`. In case the value is unbound, `Version::Unknown` is returned.
- Loading branch information
Showing
4 changed files
with
15 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters