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: cap char byte count of UTF-8 to string length #579

Merged

Conversation

christoph-heinrich
Copy link
Contributor

Capping the character byte count to the remaining string length prevents out of bounds access.

Closes #515

@christoph-heinrich christoph-heinrich changed the title fix: prevent invalid UTF-8 reading bytes beyond the string length fix: cap char byte count of UTF-8 to string length Jun 28, 2023
@po5
Copy link
Contributor

po5 commented Jun 28, 2023

Can confirm this behaves the same way as vanilla osc on the full set of chapters from my original test file.
Have you checked that wrapping works as expected?

@christoph-heinrich
Copy link
Contributor Author

Wrapping with valid utf-8 strings works as expected, I haven't tested long invalid strings. But since this only changes the length of the last char, it shouldn't make much of a difference.

@tomasklaen tomasklaen merged commit c8ad77a into tomasklaen:main Jun 28, 2023
po5 added a commit to po5/memo that referenced this pull request Jul 25, 2023
Fix from uosc tomasklaen/uosc#579
Improves truncation of the extension part
tam1m pushed a commit to tam1m/uosc that referenced this pull request Oct 2, 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.

text.lua would be broken by embedd chapters? files
3 participants