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

Fix underflow in embassy-rp uartrx.read_to_break #2492

Merged
merged 1 commit into from
Jan 29, 2024

Conversation

JomerDev
Copy link
Contributor

This fixes #2490.

In rare cases the line break can be triggered without any data having been read which causes both next_addr and sval to be the same value. Subtracting 1 and sval from next_addr causes an underflow panic in debug mode and a high chance of panic in release mode when the user uses the returned usize::Max value to try and index their data

Copy link
Contributor

@jamesmunns jamesmunns left a comment

Choose a reason for hiding this comment

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

Thank you!

@jamesmunns jamesmunns added this pull request to the merge queue Jan 29, 2024
Merged via the queue into embassy-rs:main with commit 3cd0a54 Jan 29, 2024
9 checks passed
@JomerDev JomerDev deleted the fix-read_to_break branch January 29, 2024 16:26
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.

panic in embassy-rp's uartrx.read_to_break
2 participants