[Cmake-commits] CMake branch, next, updated. v2.8.11.2-3381-g3d07638

Brad King brad.king at kitware.com
Thu Jul 25 14:34:42 EDT 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  3d07638675856055561177ddf43b443915f3348c (commit)
       via  6a365d090193bb7cd5249015b8dea7d0b9449b87 (commit)
      from  5b729c32f51084f249844941290d1a1a323c189b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3d07638675856055561177ddf43b443915f3348c
commit 3d07638675856055561177ddf43b443915f3348c
Merge: 5b729c3 6a365d0
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jul 25 14:34:36 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Jul 25 14:34:36 2013 -0400

    Merge topic 'sha2-avoid-type-pun' into next
    
    6a365d0 sha2: Avoid type-punned pointer dereference (#14314)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6a365d090193bb7cd5249015b8dea7d0b9449b87
commit 6a365d090193bb7cd5249015b8dea7d0b9449b87
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jul 25 13:03:31 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jul 25 13:10:13 2013 -0400

    sha2: Avoid type-punned pointer dereference (#14314)
    
    GCC warns:
    
     dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
    
    on constructs like
    
     *(sha_word64*)&var =
    
    so use memcpy to perform such assignments instead.

diff --git a/Source/cm_sha2.c b/Source/cm_sha2.c
index 12c39ed..24de2b2 100644
--- a/Source/cm_sha2.c
+++ b/Source/cm_sha2.c
@@ -740,7 +740,8 @@ void SHA1_Final(sha_byte digest[], SHA_CTX* context) {
 	/* Convert FROM host byte order */
 	REVERSE64(context->s1.bitcount,context->s1.bitcount);
 #endif
-	*(sha_word64*)&context->s1.buffer[56] = context->s1.bitcount;
+	MEMCPY_BCOPY(&context->s1.buffer[56], &context->s1.bitcount,
+		     sizeof(sha_word64));
 
 	/* Final transform: */
 	SHA1_Internal_Transform(context, (sha_word32*)context->s1.buffer);
@@ -1067,7 +1068,8 @@ void SHA256_Internal_Last(SHA_CTX* context) {
 		*context->s256.buffer = 0x80;
 	}
 	/* Set the bit count: */
-	*(sha_word64*)&context->s256.buffer[56] = context->s256.bitcount;
+	MEMCPY_BCOPY(&context->s256.buffer[56], &context->s256.bitcount,
+		     sizeof(sha_word64));
 
 	/* Final transform: */
 	SHA256_Internal_Transform(context, (sha_word32*)context->s256.buffer);
@@ -1475,8 +1477,10 @@ void SHA512_Internal_Last(SHA_CTX* context) {
 		*context->s512.buffer = 0x80;
 	}
 	/* Store the length of input data (in bits): */
-	*(sha_word64*)&context->s512.buffer[112] = context->s512.bitcount[1];
-	*(sha_word64*)&context->s512.buffer[120] = context->s512.bitcount[0];
+	MEMCPY_BCOPY(&context->s512.buffer[112], &context->s512.bitcount[1],
+		     sizeof(sha_word64));
+	MEMCPY_BCOPY(&context->s512.buffer[120], &context->s512.bitcount[0],
+		     sizeof(sha_word64));
 
 	/* Final transform: */
 	SHA512_Internal_Transform(context, (sha_word64*)context->s512.buffer);

-----------------------------------------------------------------------

Summary of changes:
 Source/cm_sha2.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list