gst-libs/gst/cdda/sha1.c: Use memcpy() instead of upcasting a byte array to long *. This fixes an unaligned memory ac...

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.
This commit is contained in:
Sebastian Dröge 2008-02-27 10:42:08 +00:00
parent b191c8f609
commit 07cd425c25
2 changed files with 12 additions and 4 deletions

View file

@ -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):

View 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);