[neon] fix strict-aliasing warning (upstream r1896)

jorton jorton at fedoraproject.org
Mon Mar 18 10:42:57 UTC 2013


commit da2f7ddcd07845af951fe9e256efefe81a744b71
Author: Joe Orton <jorton at redhat.com>
Date:   Mon Mar 18 10:42:52 2013 +0000

    fix strict-aliasing warning (upstream r1896)

 neon-0.29.6-md5alias.patch |   31 +++++++++++++++++++++++++++++++
 neon.spec                  |    7 ++++++-
 2 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/neon-0.29.6-md5alias.patch b/neon-0.29.6-md5alias.patch
new file mode 100644
index 0000000..6febacf
--- /dev/null
+++ b/neon-0.29.6-md5alias.patch
@@ -0,0 +1,31 @@
+
+Upstream r1896.
+
+--- neon-0.29.6/src/ne_md5.c.md5alias
++++ neon-0.29.6/src/ne_md5.c
+@@ -139,6 +139,7 @@ md5_finish_ctx (struct md5_ctx *ctx, voi
+ {
+   /* Take yet unprocessed bytes into account.  */
+   md5_uint32 bytes = ctx->buflen;
++  md5_uint32 swap_bytes;
+   size_t pad;
+ 
+   /* Now count remaining bytes.  */
+@@ -149,10 +150,13 @@ md5_finish_ctx (struct md5_ctx *ctx, voi
+   pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;
+   memcpy (&ctx->buffer[bytes], fillbuf, pad);
+ 
+-  /* Put the 64-bit file length in *bits* at the end of the buffer.  */
+-  *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);
+-  *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |
+-							(ctx->total[0] >> 29));
++  /* Put the 64-bit file length in *bits* at the end of the buffer.
++     Use memcpy to avoid aliasing problems.  On most systems, this
++     will be optimized away to the same code.  */
++  swap_bytes = SWAP (ctx->total[0] << 3);
++  memcpy (&ctx->buffer[bytes + pad], &swap_bytes, sizeof (swap_bytes));
++  swap_bytes = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
++  memcpy (&ctx->buffer[bytes + pad + 4], &swap_bytes, sizeof (swap_bytes));
+ 
+   /* Process last bytes.  */
+   md5_process_block (ctx->buffer, bytes + pad + 8, ctx);
diff --git a/neon.spec b/neon.spec
index 5a636b9..9ee68a5 100644
--- a/neon.spec
+++ b/neon.spec
@@ -1,13 +1,14 @@
 Summary: An HTTP and WebDAV client library
 Name: neon
 Version: 0.29.6
-Release: 5%{?dist}
+Release: 6%{?dist}
 License: LGPLv2+
 Group: System Environment/Libraries
 URL: http://www.webdav.org/neon/
 Source0: http://www.webdav.org/neon/neon-%{version}.tar.gz
 Patch0: neon-0.27.0-multilib.patch
 Patch1: neon-0.29.6-gnutls3.patch
+Patch2: neon-0.29.6-md5alias.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: expat-devel, gnutls-devel, zlib-devel, krb5-devel, libproxy-devel
 BuildRequires: pkgconfig, pakchois-devel
@@ -35,6 +36,7 @@ The development library for the C language HTTP and WebDAV client library.
 %setup -q
 %patch0 -p1 -b .multilib
 %patch1 -p1 -b .gnutls3
+%patch2 -p1 -b .md5alias
 
 %build
 export CC="%{__cc} -pthread"
@@ -78,6 +80,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/*.so
 
 %changelog
+* Mon Mar 18 2013 Joe Orton <jorton at redhat.com> - 0.29.6-6
+- fix strict-aliasing warning (upstream r1896)
+
 * Mon Feb 25 2013 Tomáš Mráz <tmraz at redhat.com> - 0.29.6-5
 - fix build with gnutls3 - patch by Bartosz Brachaczek
 


More information about the scm-commits mailing list