Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pid::new returns Result instead of asserting in case of an error #37

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

trnila
Copy link
Contributor

@trnila trnila commented Oct 22, 2024

The Pid::new() function can be used, for example, with untrusted PID received from master without causing a panic.

This patch may introduce a breaking change, but it can be addressed with a simple fix by checking the Option.

The Option is used as there are no meaningful possible errors.

Check the following:

  • Breaking changes marked in commit message
  • Changelog updated
  • Tests added

@trnila trnila force-pushed the pid-without-assert branch from ee65c8a to 4b2f6a4 Compare October 22, 2024 17:00
Copy link
Member

@psachs psachs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run cargo format after changing code to ensure correct formatting

src/frame.rs Outdated Show resolved Hide resolved
The Pid::new() function can be used, for example, with untrusted
PID received from master without causing a panic.

This patch may introduce a breaking change, but it can be addressed
with a simple fix by checking the Result.
@trnila trnila force-pushed the pid-without-assert branch from 4b2f6a4 to d3baaa0 Compare October 23, 2024 20:36
@trnila trnila changed the title Pid::new returns None instead of asserting in case of an error Pid::new returns Result instead of asserting in case of an error Oct 23, 2024
@psachs psachs merged commit ce51f58 into Sensirion:master Oct 24, 2024
1 check passed
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