[ldns/f19] Fix compiler warnings and one uninitialized value

Tomas Hozza thozza at fedoraproject.org
Tue Jul 23 09:31:13 UTC 2013


commit 8a9c13945d37d8dc6febafba1d4b689428f9d61e
Author: Tomas Hozza <thozza at redhat.com>
Date:   Fri Jul 19 10:11:53 2013 +0200

    Fix compiler warnings and one uninitialized value
    
    Signed-off-by: Tomas Hozza <thozza at redhat.com>

 ....16-uninitialized-value-compiler-warnings.patch |  147 ++++++++++++++++++++
 ldns.spec                                          |    7 +-
 2 files changed, 153 insertions(+), 1 deletions(-)
---
diff --git a/ldns-1.6.16-uninitialized-value-compiler-warnings.patch b/ldns-1.6.16-uninitialized-value-compiler-warnings.patch
new file mode 100644
index 0000000..81cd9e1
--- /dev/null
+++ b/ldns-1.6.16-uninitialized-value-compiler-warnings.patch
@@ -0,0 +1,147 @@
+From ab321a4f77eba0048c4cfb1081ae2c8e3496f3fd Mon Sep 17 00:00:00 2001
+From: willem <willem at af62348d-a3ea-0310-b058-bb613a78d823>
+Date: Tue, 12 Mar 2013 13:34:18 +0000
+Subject: [PATCH] - Uninitialized variable in securetrace.c - New install-sh
+ (apperantly :) - Get rid of "dereferencing type-punned pointer will break
+ strict-aliasing rules" warnings in sha2.c with gcc >= 4.7
+
+git-svn-id: http://www.nlnetlabs.nl/svn/ldns@3826 af62348d-a3ea-0310-b058-bb613a78d823
+---
+ trunk/drill/securetrace.c |  2 +-
+ trunk/install-sh          | 14 +++++++-------
+ trunk/sha2.c              | 15 ++++++++++++---
+ 3 files changed, 20 insertions(+), 11 deletions(-)
+
+diff --git a/trunk/drill/securetrace.c b/trunk/drill/securetrace.c
+index c6e7e58..9d61ec0 100644
+--- a/trunk/drill/securetrace.c
++++ b/trunk/drill/securetrace.c
+@@ -138,7 +138,7 @@ do_secure_trace(ldns_resolver *local_res, ldns_rdf *name, ldns_rr_type t,
+ 	size_t j;
+ 	size_t k;
+ 	size_t l;
+-	uint8_t labels_count;
++	uint8_t labels_count = 0;
+ 
+ 	/* dnssec */
+ 	ldns_rr_list *key_list;
+diff --git a/trunk/install-sh b/trunk/install-sh
+index a9244eb..377bb86 100755
+--- a/trunk/install-sh
++++ b/trunk/install-sh
+@@ -1,7 +1,7 @@
+ #!/bin/sh
+ # install - install a program, script, or datafile
+ 
+-scriptversion=2011-01-19.21; # UTC
++scriptversion=2011-11-20.07; # UTC
+ 
+ # This originates from X11R5 (mit/util/scripts/install.sh), which was
+ # later released in X11R6 (xc/config/util/install.sh) with the
+@@ -35,7 +35,7 @@ scriptversion=2011-01-19.21; # UTC
+ # FSF changes to this file are in the public domain.
+ #
+ # Calling this script install-sh is preferred over install.sh, to prevent
+-# `make' implicit rules from creating a file called install from it
++# 'make' implicit rules from creating a file called install from it
+ # when there is no Makefile.
+ #
+ # This script is compatible with the BSD install script, but was written
+@@ -156,7 +156,7 @@ while test $# -ne 0; do
+     -s) stripcmd=$stripprog;;
+ 
+     -t) dst_arg=$2
+-	# Protect names problematic for `test' and other utilities.
++	# Protect names problematic for 'test' and other utilities.
+ 	case $dst_arg in
+ 	  -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ 	esac
+@@ -190,7 +190,7 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+     fi
+     shift # arg
+     dst_arg=$arg
+-    # Protect names problematic for `test' and other utilities.
++    # Protect names problematic for 'test' and other utilities.
+     case $dst_arg in
+       -* | [=\(\)!]) dst_arg=./$dst_arg;;
+     esac
+@@ -202,7 +202,7 @@ if test $# -eq 0; then
+     echo "$0: no input file specified." >&2
+     exit 1
+   fi
+-  # It's OK to call `install-sh -d' without argument.
++  # It's OK to call 'install-sh -d' without argument.
+   # This can happen when creating conditional directories.
+   exit 0
+ fi
+@@ -240,7 +240,7 @@ fi
+ 
+ for src
+ do
+-  # Protect names problematic for `test' and other utilities.
++  # Protect names problematic for 'test' and other utilities.
+   case $src in
+     -* | [=\(\)!]) src=./$src;;
+   esac
+@@ -354,7 +354,7 @@ do
+ 	      if test -z "$dir_arg" || {
+ 		   # Check for POSIX incompatibilities with -m.
+ 		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+-		   # other-writeable bit of parent directory when it shouldn't.
++		   # other-writable bit of parent directory when it shouldn't.
+ 		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ 		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ 		   case $ls_ld_tmpdir in
+diff --git a/trunk/sha2.c b/trunk/sha2.c
+index 6ba4ab5..9a27122 100644
+--- a/trunk/sha2.c
++++ b/trunk/sha2.c
+@@ -546,9 +546,15 @@ void ldns_sha256_update(ldns_sha256_CTX* context, const sha2_byte *data, size_t
+ 	usedspace = freespace = 0;
+ }
+ 
++typedef union _ldns_sha2_buffer_union {
++        uint8_t*  theChars;
++        uint64_t* theLongs;
++} ldns_sha2_buffer_union;
++
+ void ldns_sha256_final(sha2_byte digest[], ldns_sha256_CTX* context) {
+ 	sha2_word32	*d = (sha2_word32*)digest;
+ 	size_t usedspace;
++	ldns_sha2_buffer_union cast_var;
+ 
+ 	/* Sanity check: */
+ 	assert(context != (ldns_sha256_CTX*)0);
+@@ -585,7 +591,8 @@ void ldns_sha256_final(sha2_byte digest[], ldns_sha256_CTX* context) {
+ 			*context->buffer = 0x80;
+ 		}
+ 		/* Set the bit count: */
+-		*(sha2_word64*)&context->buffer[ldns_sha256_SHORT_BLOCK_LENGTH] = context->bitcount;
++		cast_var.theChars = context->buffer;
++		cast_var.theLongs[ldns_sha256_SHORT_BLOCK_LENGTH / 8] = context->bitcount;
+ 
+ 		/* final transform: */
+ 		ldns_sha256_Transform(context, (sha2_word32*)context->buffer);
+@@ -850,6 +857,7 @@ void ldns_sha512_update(ldns_sha512_CTX* context, const sha2_byte *data, size_t
+ 
+ static void ldns_sha512_Last(ldns_sha512_CTX* context) {
+ 	size_t usedspace;
++	ldns_sha2_buffer_union cast_var;
+ 
+ 	usedspace = (context->bitcount[0] >> 3) % LDNS_SHA512_BLOCK_LENGTH;
+ #if BYTE_ORDER == LITTLE_ENDIAN
+@@ -882,8 +890,9 @@ static void ldns_sha512_Last(ldns_sha512_CTX* context) {
+ 		*context->buffer = 0x80;
+ 	}
+ 	/* Store the length of input data (in bits): */
+-	*(sha2_word64*)&context->buffer[ldns_sha512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
+-	*(sha2_word64*)&context->buffer[ldns_sha512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
++	cast_var.theChars = context->buffer;
++	cast_var.theLongs[ldns_sha512_SHORT_BLOCK_LENGTH / 8] = context->bitcount[1];
++	cast_var.theLongs[ldns_sha512_SHORT_BLOCK_LENGTH / 8 + 1] = context->bitcount[0];
+ 
+ 	/* final transform: */
+ 	ldns_sha512_Transform(context, (sha2_word64*)context->buffer);
+-- 
+1.8.3.1
+
diff --git a/ldns.spec b/ldns.spec
index c30bc85..96172f3 100644
--- a/ldns.spec
+++ b/ldns.spec
@@ -8,10 +8,11 @@
 Summary: Low-level DNS(SEC) library with API
 Name: ldns
 Version: 1.6.16
-Release: 4%{?dist}
+Release: 5%{?dist}
 License: BSD
 Url: http://www.nlnetlabs.nl/%{name}/
 Source: http://www.nlnetlabs.nl/downloads/%{name}/%{name}-%{version}.tar.gz
+Patch0: %{name}-1.6.16-uninitialized-value-compiler-warnings.patch
 Group: System Environment/Libraries
 BuildRequires: perl, libpcap-devel, openssl-devel, gcc-c++, doxygen,
 # for snapshots only
@@ -56,6 +57,7 @@ This package contains documentation for the ldns library
 
 %prep
 %setup -q 
+%patch0 -p2
 # To built svn snapshots
 # rm config.guess config.sub ltmain.sh
 # aclocal
@@ -140,6 +142,9 @@ rm -rf %{buildroot}
 %postun -p /sbin/ldconfig
 
 %changelog
+* Fri Jul 19 2013 Tomas Hozza <thozza at redhat.com> - 1.6.16-5
+- Fix compiler warnings and one uninitialized value
+
 * Mon Jun 03 2013 Paul Wouters <pwouters at redhat.com> - 1.6.16-4
 - Use /var/lib/unbound/root.key for --with-trust-anchor
 


More information about the scm-commits mailing list