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 overflow in blit_bitmap #545

Merged

Conversation

x3ro
Copy link
Contributor

@x3ro x3ro commented Jan 28, 2024

Hey folks, thanks for building this project 🦀

I ran into an index out of bounds error when playing around with the blit_bitmap example when using the SvgBackend instead of the BitmapBackend:

  1. blit_bitmap receives dimensions iw, ih as parameters, but also calls get_size() to retrieve the size of the DrawingBackend
  2. It then proceeds to use w, h to check whether or not the image is being drawn out of bounds (I think)
  3. However, it appears that there was a mixup when implementing the image data access, where w was used instead of iw

The attached change fixes this, though I'm not entirely sure whether the fix takes everything into account 🤔

Copy link
Member

@AaronErhardt AaronErhardt left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@AaronErhardt AaronErhardt merged commit 98e2351 into plotters-rs:master Feb 8, 2024
18 checks 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