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

Asset Packer: Fix font terminator causing freezes/crashes #295

Merged
merged 2 commits into from
Nov 10, 2024

Conversation

Willy-JL
Copy link
Member

@Willy-JL Willy-JL commented Nov 10, 2024

What's new

  • u8g2 fonts are compiled as C strings. this means they automatically get appended a 0x00 byte at the end. the string itself also ends with a \0 so u8g2 fonts end with 0x0000
  • asset packer did not add the terminator, it only used the data present in the string itself, so only 1 0x00 byte was at the end
  • this meant in some cases, when a glyph not present in the font was attempted to be drawn, u8g2 would reach the end of the font data, and overrun the buffer. depending on the byte that was immediately after the loaded font in ram, this could either have no repercussions, or it could freeze, or even crash
  • asset packer now respects C string terminators, and the produced xu8f artifact is the same memory content as the u8g2 font would have when compiled into flash

For the reviewer

  • I've uploaded the firmware with this patch to a device and verified its functionality
  • I've confirmed the bug to be fixed / feature to be stable

@Willy-JL Willy-JL added the bugfix Something isn't working label Nov 10, 2024
@Willy-JL Willy-JL self-assigned this Nov 10, 2024
Copy link

github-actions bot commented Nov 10, 2024

Compiled f7 firmware for commit 0b013077:

@Willy-JL Willy-JL merged commit 9e4ff66 into dev Nov 10, 2024
5 checks passed
@Willy-JL Willy-JL deleted the fix/font-freeze branch November 10, 2024 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant