efficient-compression-tool: fix segfault with gcc15

This commit is contained in:
Jordan Williams
2026-05-05 17:06:19 -05:00
parent c5f55618ae
commit c082c9e150
2 changed files with 18 additions and 0 deletions

View File

@@ -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;

View File

@@ -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 \