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

remaining_len - 1 may result in "attempt to subtract with overflow" #81

Closed
grovesNL opened this issue Feb 24, 2023 · 2 comments · Fixed by #82
Closed

remaining_len - 1 may result in "attempt to subtract with overflow" #81

grovesNL opened this issue Feb 24, 2023 · 2 comments · Fixed by #82

Comments

@grovesNL
Copy link
Contributor

It's possible that remaining_len attempts to subtract 1 from 0 in certain cases (I ran into it when testing font sizes in my application).

self.remaining_len -= 1;

I think it might happen when the layout line can't into the dimensions or something similar. I'll work on simplifying my test case down to verify but wanted to create this issue so I don't forget about it.

@grovesNL
Copy link
Contributor Author

It seems to be something about being right at the edge of a line, here's a repro using the rich-text example (unchanged) from main:

cosmic-repro

@grovesNL
Copy link
Contributor Author

As the font size and line height increases it becomes more likely to hit this (reason described in #82), which is why I noticed this while I was increasing my font size.

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 a pull request may close this issue.

1 participant