Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in src/patchsets/glibc/2.14.1: 0052_all_glibc-2.14-resolv-hp-assert.patch README.history
Date: Tue, 29 Nov 2011 15:59:47
Message-Id: 20111129155931.B859220034@flycatcher.gentoo.org
1 vapier 11/11/29 15:59:31
2
3 Modified: README.history
4 Added: 0052_all_glibc-2.14-resolv-hp-assert.patch
5 Log:
6 add patch from upstream bugzilla for assert in some resolver code #391673
7
8 Revision Changes Path
9 1.2 src/patchsets/glibc/2.14.1/README.history
10
11 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.14.1/README.history?rev=1.2&view=markup
12 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.14.1/README.history?rev=1.2&content-type=text/plain
13 diff : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.14.1/README.history?r1=1.1&r2=1.2
14
15 Index: README.history
16 ===================================================================
17 RCS file: /var/cvsroot/gentoo/src/patchsets/glibc/2.14.1/README.history,v
18 retrieving revision 1.1
19 retrieving revision 1.2
20 diff -u -r1.1 -r1.2
21 --- README.history 7 Nov 2011 23:02:56 -0000 1.1
22 +++ README.history 29 Nov 2011 15:59:31 -0000 1.2
23 @@ -1,3 +1,6 @@
24 +2 [pending]
25 + + 0052_all_glibc-2.14-resolv-hp-assert.patch
26 +
27 1 07 Nov 2011
28 + 0020_all_glibc-tweak-rfc1918-lookup.patch
29 + 0030_all_glibc-respect-env-CPPFLAGS.patch
30
31
32
33 1.1 src/patchsets/glibc/2.14.1/0052_all_glibc-2.14-resolv-hp-assert.patch
34
35 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.14.1/0052_all_glibc-2.14-resolv-hp-assert.patch?rev=1.1&view=markup
36 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.14.1/0052_all_glibc-2.14-resolv-hp-assert.patch?rev=1.1&content-type=text/plain
37
38 Index: 0052_all_glibc-2.14-resolv-hp-assert.patch
39 ===================================================================
40 https://bugs.gentoo.org/391673
41 http://sourceware.org/bugzilla/show_bug.cgi?id=13013
42
43 2011-07-21 Aurelien Jarno <aurel32@××××××.org>
44
45 * resolv/res_query.c(__libc_res_nquery): Assign hp and hp2
46 depending n and resplen2 to catch cases where answer
47 equals answerp2.
48
49 diff --git a/resolv/res_query.c b/resolv/res_query.c
50 index 2f7cfaa..405fa68 100644
51 --- a/resolv/res_query.c
52 +++ b/resolv/res_query.c
53 @@ -122,6 +122,7 @@ __libc_res_nquery(res_state statp,
54 int *resplen2)
55 {
56 HEADER *hp = (HEADER *) answer;
57 + HEADER *hp2;
58 int n, use_malloc = 0;
59 u_int oflags = statp->_flags;
60
61 @@ -239,26 +240,25 @@ __libc_res_nquery(res_state statp,
62 /* __libc_res_nsend might have reallocated the buffer. */
63 hp = (HEADER *) *answerp;
64
65 - /* We simplify the following tests by assigning HP to HP2. It
66 - is easy to verify that this is the same as ignoring all
67 - tests of HP2. */
68 - HEADER *hp2 = answerp2 ? (HEADER *) *answerp2 : hp;
69 -
70 - if (n < (int) sizeof (HEADER) && answerp2 != NULL
71 - && *resplen2 > (int) sizeof (HEADER))
72 + /* We simplify the following tests by assigning HP to HP2 or
73 + vice versa. It is easy to verify that this is the same as
74 + ignoring all tests of HP or HP2. */
75 + if (answerp2 == NULL || *resplen2 < (int) sizeof (HEADER))
76 {
77 - /* Special case of partial answer. */
78 - assert (hp != hp2);
79 - hp = hp2;
80 + hp2 = hp;
81 }
82 - else if (answerp2 != NULL && *resplen2 < (int) sizeof (HEADER)
83 - && n > (int) sizeof (HEADER))
84 + else
85 {
86 - /* Special case of partial answer. */
87 - assert (hp != hp2);
88 - hp2 = hp;
89 + hp2 = (HEADER *) *answerp2;
90 + if (n < (int) sizeof (HEADER))
91 + {
92 + hp = hp2;
93 + }
94 }
95
96 + /* Make sure both hp and hp2 are defined */
97 + assert((hp != NULL) && (hp2 != NULL));
98 +
99 if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0)
100 && (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) {
101 #ifdef DEBUG