diff --git a/pkgs/by-name/ef/efficient-compression-tool/ect-gcc-15-O3-fix.patch b/pkgs/by-name/ef/efficient-compression-tool/ect-gcc-15-O3-fix.patch new file mode 100644 index 000000000000..f4c6221058e3 --- /dev/null +++ b/pkgs/by-name/ef/efficient-compression-tool/ect-gcc-15-O3-fix.patch @@ -0,0 +1,13 @@ +diff --git a/src/LzFind.c b/src/LzFind.c +index 98d0ac6..f1bee55 100755 +--- a/src/LzFind.c ++++ b/src/LzFind.c +@@ -229,7 +229,7 @@ static unsigned short * GetMatches2(UInt32 lenLimit, UInt32 curMatch, UInt32 pos + const unsigned char* _min = min; + unsigned cnt = 0; + if (_min < pb - (rle_len - len)) {_min = pb - (rle_len - len);} +- while (rle_pos > _min && *(uint64_t*)(rle_pos - 8) == starter_full) {rle_pos-=8; cnt+=8;} ++ while (rle_pos > _min && *(__typeof__(const uint64_t __attribute__((aligned(1))))*)(rle_pos - 8) == starter_full) {rle_pos-=8; cnt+=8;} + if (cnt) { + if (cnt + len > rle_len - 1) {cnt = rle_len - 1 - len;} + curMatch_rle -= cnt; diff --git a/pkgs/by-name/ef/efficient-compression-tool/package.nix b/pkgs/by-name/ef/efficient-compression-tool/package.nix index 10da59dc6f3b..6871e59a01f7 100644 --- a/pkgs/by-name/ef/efficient-compression-tool/package.nix +++ b/pkgs/by-name/ef/efficient-compression-tool/package.nix @@ -22,6 +22,11 @@ stdenv.mkDerivation (finalAttrs: { fetchSubmodules = true; }; + patches = [ + # from https://github.com/fhanau/Efficient-Compression-Tool/issues/145 + ./ect-gcc-15-O3-fix.patch + ]; + # devendor libpng postPatch = '' substituteInPlace src/CMakeLists.txt \