Modern toolchains (like GCC 15/16) tracking strict value propagation
throw an overflow error when compiled with `-Werror` on Big Endian
architectures like s390x.
The BMP header specification defines `planes` and `bpp` as 16-bit
unsigned integers (`uint16_t`). The `loader_ico.c` file
was wrapping them in `SWAP_LE_32_INPLACE`, forcing a 32-bit
manipulation
that narrows back to 16 bits. On Little Endian hosts, this is optimized
out
as a no-op, but on Big Endian architectures, it actively swaps bytes,
resulting in an explicit narrowing overflow and potential data
corruption.
Fix this by replacing `SWAP_LE_32_INPLACE` with the correct 16-bit
counterpart `SWAP_LE_16_INPLACE` for the `planes` and `bpp` fields.
---
src/modules/loaders/loader_ico.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/modules/loaders/loader_ico.c
b/src/modules/loaders/loader_ico.c
index 6d50366..0fa2051 100644
--- a/src/modules/loaders/loader_ico.c
+++ b/src/modules/loaders/loader_ico.c
@@ -156,8 +156,8 @@ ico_read_icon(ico_t *ico, int ino)
SWAP_LE_32_INPLACE(ie->bih.width);
SWAP_LE_32_INPLACE(ie->bih.height);
- SWAP_LE_32_INPLACE(ie->bih.planes);
- SWAP_LE_32_INPLACE(ie->bih.bpp);
+ SWAP_LE_16_INPLACE(ie->bih.planes);
+ SWAP_LE_16_INPLACE(ie->bih.bpp);
SWAP_LE_32_INPLACE(ie->bih.compression);
SWAP_LE_32_INPLACE(ie->bih.size);
--
2.55.0
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel