On Sat, Jun 09 2018, Jeremie Courreges-Anglas <j...@wxcvbn.org> wrote:
> On Sat, Jun 09 2018, Björn Ketelaars <bjorn.ketela...@hydroxide.nl> wrote:
>> Enclosed diff brings zopfli to 1.0.2, which fixes some bugs. If
>> I understand [0] correctly, this version should build, and work on the
>> previously excluded m88k. However, I'm unable to test.
>>
>> Built, and tested on amd64.
>>
>> Comments/OKs?
>
> ok jca@

I gave it a try on sparc64, where it crashes (SIGBUS).  This already
happens with the in-tree version.  The diff below works around the
problem (not portable, shouldn't be pushed upstream as-is).  Feel free
to add it to your update.


Index: patches/patch-src_zopfli_lz77_c
===================================================================
--- /dev/null
+++ patches/patch-src_zopfli_lz77_c
@@ -0,0 +1,26 @@
+$OpenBSD$
+
+Unbreak on architectures with strict alignement requirements.
+
+Index: src/zopfli/lz77.c
+--- src/zopfli/lz77.c.orig
++++ src/zopfli/lz77.c
+@@ -299,6 +299,7 @@ static const unsigned char* GetMatch(const unsigned ch
+                                      const unsigned char* end,
+                                      const unsigned char* safe_end) {
+ 
++#ifndef __STRICT_ALIGNMENT
+   if (sizeof(size_t) == 8) {
+     /* 8 checks at once per array bounds check (size_t is 64-bit). */
+     while (scan < safe_end && *((size_t*)scan) == *((size_t*)match)) {
+@@ -312,7 +313,9 @@ static const unsigned char* GetMatch(const unsigned ch
+       scan += 4;
+       match += 4;
+     }
+-  } else {
++  } else
++#endif /* ! __STRICT_ALIGNMENT */
++  {
+     /* do 8 checks at once per array bounds check. */
+     while (scan < safe_end && *scan == *match && *++scan == *++match
+           && *++scan == *++match && *++scan == *++match


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to