Your message dated Tue, 15 Apr 2008 11:17:06 +0000
with message-id <[EMAIL PROTECTED]>
and subject line Bug#476234: fixed in wavpack 4.41.0-2
has caused the Debian Bug report #476234,
regarding Unaligned memory accesses on sparc
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [EMAIL PROTECTED]
immediately.)


-- 
476234: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=476234
Debian Bug Tracking System
Contact [EMAIL PROTECTED] with problems
--- Begin Message ---
Package: wavpack
Severity: important

wavpack currently has some unaligned memory accesses that result in
SIGBUS on sparc.

> Program received signal SIGBUS, Bus error.
> 0xf7edde84 in little_endian_to_native (data=0x28ce2, format=0x16411 "L")
>     at bits.c:143
> 143                     * (int32_t *) cp = temp;
> (gdb) bt
> #0  0xf7edde84 in little_endian_to_native (data=0x28ce2, format=0x16411 "L")
>     at bits.c:143
> #1  0xf7eff284 in WavpackLittleEndianToNative (data=0x28ce2, 
>     format=0x16410 "4L") at wputils.c:2862
> #2  0x00014504 in main (argc=<value optimized out>, argv=<value optimized 
> out>)
>     at wavpack.c:1368


Fixing little_endian_to_native() and native_to_little_endian() with the attached
patch gives the following:

> Program received signal SIGBUS, Bus error.
> 0x00015708 in pack_file (infilename=0x2c018 "test.wav", 
>     outfilename=0x2c030 "test.wv", out2filename=0x0, config=0xffa036f4)
>     at wavpack.c:1369
> 1369                                riffhdr->ckSize = wrapper_size + 
> data_size - 8;
> (gdb) bt
> #0  0x00015708 in pack_file (infilename=0x2c018 "test.wav", 
>     outfilename=0x2c030 "test.wv", out2filename=0x0, config=0xffa036f4)
>     at wavpack.c:1369
> #1  0x000136ac in main (argc=0, argv=0xffa038cc) at wavpack.c:772

This is then fixed by the second part of the patch. The same code is again in 
src/wputils.c,
also fixed in the patch.



So the only problem left is, that this crashes when compiled with optimizations 
(i.e. greater -O0).
--- wavpack-4.41.0.orig/cli/wavpack.c
+++ wavpack-4.41.0/cli/wavpack.c
@@ -1365,14 +1365,16 @@
                         uint32_t data_size = WavpackGetSampleIndex (wpc) * WavpackGetNumChannels (wpc) * WavpackGetBytesPerSample (wpc);
 
                         if (!strncmp (riffhdr->ckID, "RIFF", 4)) {
+                            uint32_t tmp = wrapper_size + data_size - 8;
+
                             WavpackLittleEndianToNative (riffhdr, ChunkHeaderFormat);
-                            riffhdr->ckSize = wrapper_size + data_size - 8;
+                            memcpy (&riffhdr->ckSize, &tmp, sizeof (uint32_t));
                             WavpackNativeToLittleEndian (riffhdr, ChunkHeaderFormat);
                         }
 
                         if (!strncmp (datahdr->ckID, "data", 4)) {
                             WavpackLittleEndianToNative (datahdr, ChunkHeaderFormat);
-                            datahdr->ckSize = data_size;
+                            memcpy (&datahdr->ckSize, &data_size, sizeof (uint32_t));
                             WavpackNativeToLittleEndian (datahdr, ChunkHeaderFormat);
                         }
                     }
--- wavpack-4.41.0.orig/src/bits.c
+++ wavpack-4.41.0/src/bits.c
@@ -135,18 +135,19 @@
 {
     uchar *cp = (uchar *) data;
     int32_t temp;
+    short temp2;
 
     while (*format) {
         switch (*format) {
             case 'L':
                 temp = cp [0] + ((int32_t) cp [1] << 8) + ((int32_t) cp [2] << 16) + ((int32_t) cp [3] << 24);
-                * (int32_t *) cp = temp;
+                memcpy (cp, &temp, sizeof (int32_t));
                 cp += 4;
                 break;
 
             case 'S':
-                temp = cp [0] + (cp [1] << 8);
-                * (short *) cp = (short) temp;
+                temp2 = cp [0] + (cp [1] << 8);
+                memcpy (cp, &temp2, sizeof (short));
                 cp += 2;
                 break;
 
@@ -165,11 +166,12 @@
 {
     uchar *cp = (uchar *) data;
     int32_t temp;
+    short temp2;
 
     while (*format) {
         switch (*format) {
             case 'L':
-                temp = * (int32_t *) cp;
+                memcpy (&temp, cp, sizeof (int32_t));
                 *cp++ = (uchar) temp;
                 *cp++ = (uchar) (temp >> 8);
                 *cp++ = (uchar) (temp >> 16);
@@ -177,9 +179,9 @@
                 break;
 
             case 'S':
-                temp = * (short *) cp;
-                *cp++ = (uchar) temp;
-                *cp++ = (uchar) (temp >> 8);
+                memcpy (&temp2, cp, sizeof (short));
+                *cp++ = (uchar) temp2;
+                *cp++ = (uchar) (temp2 >> 8);
                 break;
 
             default:
--- wavpack-4.41.0.orig/src/wputils.c
+++ wavpack-4.41.0/src/wputils.c
@@ -1644,9 +1644,12 @@
 void WavpackUpdateNumSamples (WavpackContext *wpc, void *first_block)
 {
     uint32_t wrapper_size;
+    uint32_t total_samples;
 
     little_endian_to_native (first_block, WavpackHeaderFormat);
-    ((WavpackHeader *) first_block)->total_samples = WavpackGetSampleIndex (wpc);
+    
+    total_samples = WavpackGetSampleIndex (wpc);
+    memcpy (&((WavpackHeader *) first_block)->total_samples, &total_samples, sizeof (uint32_t));
 
     if (wpc->riff_header_created) {
         if (WavpackGetWrapperLocation (first_block, &wrapper_size)) {
@@ -1655,14 +1658,16 @@
             uint32_t data_size = WavpackGetSampleIndex (wpc) * WavpackGetNumChannels (wpc) * WavpackGetBytesPerSample (wpc);
 
             if (!strncmp (riffhdr->ckID, "RIFF", 4)) {
+                uint32_t tmp = wrapper_size + data_size - 8;
+
                 little_endian_to_native (riffhdr, ChunkHeaderFormat);
-                riffhdr->ckSize = wrapper_size + data_size - 8;
+                memcpy (&riffhdr->ckSize, &tmp, sizeof (uint32_t));
                 native_to_little_endian (riffhdr, ChunkHeaderFormat);
             }
 
             if (!strncmp (datahdr->ckID, "data", 4)) {
                 little_endian_to_native (datahdr, ChunkHeaderFormat);
-                datahdr->ckSize = data_size;
+                memcpy (&datahdr->ckSize, &data_size, sizeof (uint32_t));
                 native_to_little_endian (datahdr, ChunkHeaderFormat);
             }
         }

--- End Message ---
--- Begin Message ---
Source: wavpack
Source-Version: 4.41.0-2

We believe that the bug you reported is fixed in the latest version of
wavpack, which is due to be installed in the Debian FTP archive:

libwavpack-dev_4.41.0-2_i386.deb
  to pool/main/w/wavpack/libwavpack-dev_4.41.0-2_i386.deb
libwavpack1_4.41.0-2_i386.deb
  to pool/main/w/wavpack/libwavpack1_4.41.0-2_i386.deb
wavpack_4.41.0-2.diff.gz
  to pool/main/w/wavpack/wavpack_4.41.0-2.diff.gz
wavpack_4.41.0-2.dsc
  to pool/main/w/wavpack/wavpack_4.41.0-2.dsc
wavpack_4.41.0-2_i386.deb
  to pool/main/w/wavpack/wavpack_4.41.0-2_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [EMAIL PROTECTED],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Sebastian Dröge <[EMAIL PROTECTED]> (supplier of updated wavpack package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [EMAIL PROTECTED])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Tue, 15 Apr 2008 12:22:24 +0200
Source: wavpack
Binary: libwavpack1 libwavpack-dev wavpack
Architecture: source i386
Version: 4.41.0-2
Distribution: unstable
Urgency: low
Maintainer: Sebastian Dröge <[EMAIL PROTECTED]>
Changed-By: Sebastian Dröge <[EMAIL PROTECTED]>
Description: 
 libwavpack-dev - an audio codec (lossy and lossless) - development files
 libwavpack1 - an audio codec (lossy and lossless) - library
 wavpack    - an audio codec (lossy and lossless) - encoder and decoder
Closes: 476234
Changes: 
 wavpack (4.41.0-2) unstable; urgency=low
 .
   * debian/libwavpack1.symbols,
     debian/control:
     + Add a symbol file for WavPack and build depend on new enough dpkg-dev
       for this.
   * debian/control:
     + Update Standards-Version to 3.7.3, no additional changes needed.
     + Use ${binary:Version} instead of ${Source-Version}.
   * debian/patches/01_memory-alignment.patch:
     + Fix alignment issues which result in a SIGBUS on sparc (Closes: #476234).
Checksums-Sha1: 
 ad5a2d718157b33384e346af6ae66b6fd6dc3b4b 1096 wavpack_4.41.0-2.dsc
 ca664c8e10c362b8922851720f27f9efc100b111 7092 wavpack_4.41.0-2.diff.gz
 6d324633971aa345d462bb707311039893d8e4ca 77406 libwavpack1_4.41.0-2_i386.deb
 92c4bc15c5c205d459f16dbae91e88cb2ac776a7 84858 libwavpack-dev_4.41.0-2_i386.deb
 6aedd31a4989e1312a843aecdc9972a65e1c0260 51810 wavpack_4.41.0-2_i386.deb
Checksums-Sha256: 
 e30798a690c5dc8bae2780505eb4e04b08daa0f3d7bd364579bc43bb0acdfa57 1096 
wavpack_4.41.0-2.dsc
 e609f70c826c8cbca42adc1198b855f93c987c393d1bdc35a94bdf9dfccceabb 7092 
wavpack_4.41.0-2.diff.gz
 b993ae6bbb7a51aff00826b76be87fd6b4d33825d2c1000cfff6551e93deb206 77406 
libwavpack1_4.41.0-2_i386.deb
 e1bec3bcfe440ac762e73c09bfa428ba9fff486e562a1469afcffbfe0d7f5cf7 84858 
libwavpack-dev_4.41.0-2_i386.deb
 88b32d47d6dcac64c485d3660c2b00623db65ecf97479dd198df4c42ff9fe63f 51810 
wavpack_4.41.0-2_i386.deb
Files: 
 da9345676237b8ea11088541c952eb7e 1096 sound optional wavpack_4.41.0-2.dsc
 6d1b35799d529b6949229d251e4098bc 7092 sound optional wavpack_4.41.0-2.diff.gz
 c3227d7e7cef5586d1cdfdbfea933729 77406 libs optional 
libwavpack1_4.41.0-2_i386.deb
 3314a115bd0f1bdb040ea592fdfd34c4 84858 libdevel optional 
libwavpack-dev_4.41.0-2_i386.deb
 592a1d08e4bf7910b3ea61faf393a222 51810 sound optional wavpack_4.41.0-2_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIBIrvBsBdh1vkHyERAvbzAJwOPyEj/NmXYLYP7lPLNagznF2GGQCfRhMh
q5HAPxVOggvZRdVIYDmJUPE=
=fdqV
-----END PGP SIGNATURE-----



--- End Message ---

Reply via email to