gst-libs/gst/cdda/sha1.c: Use memcpy() instead of upcasting a byte array to long...
authorSebastian Dröge <slomo@circular-chaos.org>
Wed, 27 Feb 2008 10:42:08 +0000 (10:42 +0000)
committerSebastian Dröge <slomo@circular-chaos.org>
Wed, 27 Feb 2008 10:42:08 +0000 (10:42 +0000)
Original commit message from CVS:
* gst-libs/gst/cdda/sha1.c: (sha_transform):
Use memcpy() instead of upcasting a byte array to long *. This
fixes an unaligned memory access, resulting in SIGBUS on IA64.
This should be ported to GCheckSum once we can use GLib 2.16.
Partially fixes bug #500833.

ChangeLog
gst-libs/gst/cdda/sha1.c

index e9e7c04..79dbeeb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-02-27  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * gst-libs/gst/cdda/sha1.c: (sha_transform):
+       Use memcpy() instead of upcasting a byte array to long *. This
+       fixes an unaligned memory access, resulting in SIGBUS on IA64.
+       This should be ported to GCheckSum once we can use GLib 2.16.
+       Partially fixes bug #500833.
+
 2008-02-27  Tim-Philipp Müller  <tim at centricular dot net>
 
        * gst-libs/gst/tag/gsttagdemux.c: (gst_tag_demux_chain):
index d406bad..41f5f85 100644 (file)
@@ -99,7 +99,7 @@ nether regions of the anatomy...
 #if (SHA_BYTE_ORDER == 1234)
 #define SWAP_DONE
   for (i = 0; i < 16; ++i) {
-    T = *((SHA_LONG *) dp);
+    memcpy (&T, dp, sizeof (SHA_LONG));
     dp += 4;
     W[i] = ((T << 24) & 0xff000000) | ((T << 8) & 0x00ff0000) |
         ((T >> 8) & 0x0000ff00) | ((T >> 24) & 0x000000ff);
@@ -109,7 +109,7 @@ nether regions of the anatomy...
 #if (SHA_BYTE_ORDER == 4321)
 #define SWAP_DONE
   for (i = 0; i < 16; ++i) {
-    T = *((SHA_LONG *) dp);
+    memcpy (&T, dp, sizeof (SHA_LONG));
     dp += 4;
     W[i] = T32 (T);
   }
@@ -118,7 +118,7 @@ nether regions of the anatomy...
 #if (SHA_BYTE_ORDER == 12345678)
 #define SWAP_DONE
   for (i = 0; i < 16; i += 2) {
-    T = *((SHA_LONG *) dp);
+    memcpy (&T, dp, sizeof (SHA_LONG));
     dp += 8;
     W[i] = ((T << 24) & 0xff000000) | ((T << 8) & 0x00ff0000) |
         ((T >> 8) & 0x0000ff00) | ((T >> 24) & 0x000000ff);
@@ -131,7 +131,7 @@ nether regions of the anatomy...
 #if (SHA_BYTE_ORDER == 87654321)
 #define SWAP_DONE
   for (i = 0; i < 16; i += 2) {
-    T = *((SHA_LONG *) dp);
+    memcpy (&T, dp, sizeof (SHA_LONG));
     dp += 8;
     W[i] = T32 (T >> 32);
     W[i + 1] = T32 (T);