mini-qoi icon indicating copy to clipboard operation
mini-qoi copied to clipboard

fix alignment of fields within mqoi_desc_t

Open clhuang opened this issue 2 months ago • 0 comments

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.

clhuang avatar May 14 '24 03:05 clhuang