[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#942746: Acknowledgement (libsoxr: Testsuite crashes on spar64 due to unaligned access in soxr_output_no_callback)



Control: tags -1 +patch

Hi!

One of the Gentoo SPARC maintainers had a go at this and came up with
a simple patch very quickly which I am attaching to this bug report.

Could you include the patch in the next upload? He's also going to send
this patch upstream.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
diff --git a/src/soxr.c b/src/soxr.c
index c2861ac..15e0b09 100644
--- a/src/soxr.c
+++ b/src/soxr.c
@@ -653,7 +653,7 @@ static size_t soxr_input(soxr_t p, void const * in, size_t len)
 
 
 
-static size_t soxr_output_1ch(soxr_t p, unsigned i, soxr_buf_t dest, size_t len, bool separated)
+static size_t soxr_output_1ch(soxr_t p, unsigned i, soxr_bufs_t dest, size_t len, bool separated)
 {
   sample_t const * src;
   if (p->flushing)
@@ -661,7 +661,7 @@ static size_t soxr_output_1ch(soxr_t p, unsigned i, soxr_buf_t dest, size_t len,
   resampler_process(p->resamplers[i], len);
   src = resampler_output(p->resamplers[i], NULL, &len);
   if (separated)
-    p->clips += (p->interleave)(p->io_spec.otype, &dest, &src,
+    p->clips += (p->interleave)(p->io_spec.otype, dest[i], &src,
       len, 1, (p->io_spec.flags & SOXR_NO_DITHER)? 0 : &p->seed);
   else p->channel_ptrs[i] = (void /* const */ *)src;
   return len;
@@ -680,13 +680,13 @@ static size_t soxr_output_no_callback(soxr_t p, soxr_buf_t out, size_t len)
 #pragma omp parallel for
   for (i = 0; i < (int)p->num_channels; ++i) {
     size_t done1;
-    done1 = soxr_output_1ch(p, (unsigned)i, ((soxr_bufs_t)out)[i], len, separated);
+    done1 = soxr_output_1ch(p, (unsigned)i, (soxr_bufs_t)out, len, separated);
     if (!i)
       done = done1;
   } else
 #endif
   for (u = 0; u < p->num_channels; ++u)
-    done = soxr_output_1ch(p, u, ((soxr_bufs_t)out)[u], len, separated);
+    done = soxr_output_1ch(p, u, (soxr_bufs_t)out, len, separated);
 
   if (!separated)
     p->clips += (p->interleave)(p->io_spec.otype, &out, (sample_t const * const *)p->channel_ptrs,
@@ -783,7 +783,7 @@ soxr_error_t soxr_process(soxr_t p,
       size_t done;
       if (in)
         soxr_input_1ch(p, (unsigned)i, ((soxr_cbufs_t)in)[i], ilen);
-      done = soxr_output_1ch(p, (unsigned)i, ((soxr_bufs_t)out)[i], olen, true);
+      done = soxr_output_1ch(p, (unsigned)i, (soxr_bufs_t)out, olen, true);
       if (!i)
         odone = done;
     } else
@@ -791,7 +791,7 @@ soxr_error_t soxr_process(soxr_t p,
     for (u = 0; u < p->num_channels; ++u) {
       if (in)
         soxr_input_1ch(p, u, ((soxr_cbufs_t)in)[u], ilen);
-      odone = soxr_output_1ch(p, u, ((soxr_bufs_t)out)[u], olen, true);
+      odone = soxr_output_1ch(p, u, (soxr_bufs_t)out, olen, true);
     }
     idone = ilen;
   }

Reply to: