/[smecontribs]/rpms/ldns/contribs9/ldns-1.6.16-uninitialized-value-compiler-warnings.patch
ViewVC logotype

Contents of /rpms/ldns/contribs9/ldns-1.6.16-uninitialized-value-compiler-warnings.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Wed Mar 9 12:19:19 2016 UTC (8 years, 1 month ago) by unnilennium
Branch: MAIN
CVS Tags: ldns-1_6_16-7_el6_1, ldns-1_6_16-7_el6_sme_1, HEAD
Initial import

1 From ab321a4f77eba0048c4cfb1081ae2c8e3496f3fd Mon Sep 17 00:00:00 2001
2 From: willem <willem@af62348d-a3ea-0310-b058-bb613a78d823>
3 Date: Tue, 12 Mar 2013 13:34:18 +0000
4 Subject: [PATCH] - Uninitialized variable in securetrace.c - New install-sh
5 (apperantly :) - Get rid of "dereferencing type-punned pointer will break
6 strict-aliasing rules" warnings in sha2.c with gcc >= 4.7
7
8 git-svn-id: http://www.nlnetlabs.nl/svn/ldns@3826 af62348d-a3ea-0310-b058-bb613a78d823
9 ---
10 trunk/drill/securetrace.c | 2 +-
11 trunk/install-sh | 14 +++++++-------
12 trunk/sha2.c | 15 ++++++++++++---
13 3 files changed, 20 insertions(+), 11 deletions(-)
14
15 diff --git a/trunk/drill/securetrace.c b/trunk/drill/securetrace.c
16 index c6e7e58..9d61ec0 100644
17 --- a/trunk/drill/securetrace.c
18 +++ b/trunk/drill/securetrace.c
19 @@ -138,7 +138,7 @@ do_secure_trace(ldns_resolver *local_res, ldns_rdf *name, ldns_rr_type t,
20 size_t j;
21 size_t k;
22 size_t l;
23 - uint8_t labels_count;
24 + uint8_t labels_count = 0;
25
26 /* dnssec */
27 ldns_rr_list *key_list;
28 diff --git a/trunk/install-sh b/trunk/install-sh
29 index a9244eb..377bb86 100755
30 --- a/trunk/install-sh
31 +++ b/trunk/install-sh
32 @@ -1,7 +1,7 @@
33 #!/bin/sh
34 # install - install a program, script, or datafile
35
36 -scriptversion=2011-01-19.21; # UTC
37 +scriptversion=2011-11-20.07; # UTC
38
39 # This originates from X11R5 (mit/util/scripts/install.sh), which was
40 # later released in X11R6 (xc/config/util/install.sh) with the
41 @@ -35,7 +35,7 @@ scriptversion=2011-01-19.21; # UTC
42 # FSF changes to this file are in the public domain.
43 #
44 # Calling this script install-sh is preferred over install.sh, to prevent
45 -# `make' implicit rules from creating a file called install from it
46 +# 'make' implicit rules from creating a file called install from it
47 # when there is no Makefile.
48 #
49 # This script is compatible with the BSD install script, but was written
50 @@ -156,7 +156,7 @@ while test $# -ne 0; do
51 -s) stripcmd=$stripprog;;
52
53 -t) dst_arg=$2
54 - # Protect names problematic for `test' and other utilities.
55 + # Protect names problematic for 'test' and other utilities.
56 case $dst_arg in
57 -* | [=\(\)!]) dst_arg=./$dst_arg;;
58 esac
59 @@ -190,7 +190,7 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
60 fi
61 shift # arg
62 dst_arg=$arg
63 - # Protect names problematic for `test' and other utilities.
64 + # Protect names problematic for 'test' and other utilities.
65 case $dst_arg in
66 -* | [=\(\)!]) dst_arg=./$dst_arg;;
67 esac
68 @@ -202,7 +202,7 @@ if test $# -eq 0; then
69 echo "$0: no input file specified." >&2
70 exit 1
71 fi
72 - # It's OK to call `install-sh -d' without argument.
73 + # It's OK to call 'install-sh -d' without argument.
74 # This can happen when creating conditional directories.
75 exit 0
76 fi
77 @@ -240,7 +240,7 @@ fi
78
79 for src
80 do
81 - # Protect names problematic for `test' and other utilities.
82 + # Protect names problematic for 'test' and other utilities.
83 case $src in
84 -* | [=\(\)!]) src=./$src;;
85 esac
86 @@ -354,7 +354,7 @@ do
87 if test -z "$dir_arg" || {
88 # Check for POSIX incompatibilities with -m.
89 # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
90 - # other-writeable bit of parent directory when it shouldn't.
91 + # other-writable bit of parent directory when it shouldn't.
92 # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
93 ls_ld_tmpdir=`ls -ld "$tmpdir"`
94 case $ls_ld_tmpdir in
95 diff --git a/trunk/sha2.c b/trunk/sha2.c
96 index 6ba4ab5..9a27122 100644
97 --- a/trunk/sha2.c
98 +++ b/trunk/sha2.c
99 @@ -546,9 +546,15 @@ void ldns_sha256_update(ldns_sha256_CTX* context, const sha2_byte *data, size_t
100 usedspace = freespace = 0;
101 }
102
103 +typedef union _ldns_sha2_buffer_union {
104 + uint8_t* theChars;
105 + uint64_t* theLongs;
106 +} ldns_sha2_buffer_union;
107 +
108 void ldns_sha256_final(sha2_byte digest[], ldns_sha256_CTX* context) {
109 sha2_word32 *d = (sha2_word32*)digest;
110 size_t usedspace;
111 + ldns_sha2_buffer_union cast_var;
112
113 /* Sanity check: */
114 assert(context != (ldns_sha256_CTX*)0);
115 @@ -585,7 +591,8 @@ void ldns_sha256_final(sha2_byte digest[], ldns_sha256_CTX* context) {
116 *context->buffer = 0x80;
117 }
118 /* Set the bit count: */
119 - *(sha2_word64*)&context->buffer[ldns_sha256_SHORT_BLOCK_LENGTH] = context->bitcount;
120 + cast_var.theChars = context->buffer;
121 + cast_var.theLongs[ldns_sha256_SHORT_BLOCK_LENGTH / 8] = context->bitcount;
122
123 /* final transform: */
124 ldns_sha256_Transform(context, (sha2_word32*)context->buffer);
125 @@ -850,6 +857,7 @@ void ldns_sha512_update(ldns_sha512_CTX* context, const sha2_byte *data, size_t
126
127 static void ldns_sha512_Last(ldns_sha512_CTX* context) {
128 size_t usedspace;
129 + ldns_sha2_buffer_union cast_var;
130
131 usedspace = (context->bitcount[0] >> 3) % LDNS_SHA512_BLOCK_LENGTH;
132 #if BYTE_ORDER == LITTLE_ENDIAN
133 @@ -882,8 +890,9 @@ static void ldns_sha512_Last(ldns_sha512_CTX* context) {
134 *context->buffer = 0x80;
135 }
136 /* Store the length of input data (in bits): */
137 - *(sha2_word64*)&context->buffer[ldns_sha512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
138 - *(sha2_word64*)&context->buffer[ldns_sha512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
139 + cast_var.theChars = context->buffer;
140 + cast_var.theLongs[ldns_sha512_SHORT_BLOCK_LENGTH / 8] = context->bitcount[1];
141 + cast_var.theLongs[ldns_sha512_SHORT_BLOCK_LENGTH / 8 + 1] = context->bitcount[0];
142
143 /* final transform: */
144 ldns_sha512_Transform(context, (sha2_word64*)context->buffer);
145 --
146 1.8.3.1
147

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed