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

Check for buffer overflow in prerendered variant #29

Merged

Conversation

embediver
Copy link

In the prerendered variant one can pass a iterator with more elements than LEDs, which leads to a buffer overflow.

This PR fixes this by adding a new error type for the prerendered variant.

pub enum Error<E> {
    OutOfBounds,
    Spi(E),
}

Now the current index will be checked in write_byte() and return an OutOfBounds error if it will exceed the data buffer size.

Now, when the provided iterator is to large, returns an apropiate error.
@david-sawatzke david-sawatzke merged commit 0bc6d4f into smart-leds-rs:master Apr 14, 2023
@david-sawatzke
Copy link
Collaborator

Thank you, this looks good!

david-sawatzke added a commit that referenced this pull request Apr 14, 2023
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