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 alignment of fields within mqoi_desc_t #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

clhuang
Copy link

@clhuang clhuang commented May 14, 2024

Attempting to use the minimal code example on an RP2040 fails (the board crashes) while attempting to run mqoi_desc_verify.
I narrowed the crash down to the line https://github.com/shraiwi/mini-qoi/blob/master/src/mini_qoi.c#L34, which casts a potentially unaligned uint8_t* to a uint32_t*, which is undefined behavior. Padding the struct so the width/height fields are 4-byte aligned fixes the issue.

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.

1 participant