| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
ffBase64EncodeRaw unconditionally byte-swapped the input word via __builtin_bswap32, which only produces the intended big-endian byte layout on little-endian hosts. On big-endian hosts the word is already in the correct order, so the swap corrupted the encoded output. Guard the swap with __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ so the encoder is correct on both endiannesses.
Up to standards ✅🟢 Issues 0 issues
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer |
Sorry, something went wrong.
|
Thanks. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
ffBase64EncodeRaw() unconditionally byte-swaps the input word with __builtin_bswap32(), which only yields the intended big-endian byte layout on little-endian hosts. On big-endian hosts the 32-bit load is already in the correct order, so the swap reorders the bytes within every 3-byte group and emits corrupted base64.
All currently tested platforms (x86-64, aarch64) are little-endian, so the bug is latent there. I hit it while porting fastfetch to the NetBSD/amiga (Motorola 68k) target. ffBase64EncodeStrbuf() is used only in the image-logo path (src/logo/image/image.c): the iTerm inline-image protocol (which encodes the image bytes) and the kitty-direct protocol (which encodes the image path). So on a big-endian machine, image logos are transmitted as malformed base64 and fail to render; text/ASCII logos, info modules and --format json are unaffected.
The fix simply guards the swap so it only runs on little-endian hosts, leaving little-endian output byte-for-byte unchanged.
Testing
Related issue
N/A
Changes
Checklist