From 89c17cfdd5a122ac8f8b2d22e67c85695bedeea3f7cf077fb6c650729ab3f0a5 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Mon, 19 Sep 2011 08:08:15 +0000 Subject: [PATCH] Accepting request 82412 from home:michal-m:branches:Base:System - Fix assertion error in res_query.c, triggered by Firefox (bso#13013). OBS-URL: https://build.opensuse.org/request/show/82412 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=105 --- glibc-resolv-assert.diff | 59 ++++++++++++++++++++++++++++++++++++++++ glibc.changes | 6 ++++ glibc.spec | 4 ++- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 glibc-resolv-assert.diff diff --git a/glibc-resolv-assert.diff b/glibc-resolv-assert.diff new file mode 100644 index 0000000..fcb478e --- /dev/null +++ b/glibc-resolv-assert.diff @@ -0,0 +1,59 @@ +2011-07-21 Aurelien Jarno + + * resolv/res_query.c(__libc_res_nquery): Assign hp and hp2 + depending n and resplen2 to catch cases where answer + equals answerp2. + +diff --git a/resolv/res_query.c b/resolv/res_query.c +index 2f7cfaa..405fa68 100644 +--- a/resolv/res_query.c ++++ b/resolv/res_query.c +@@ -122,6 +122,7 @@ __libc_res_nquery(res_state statp, + int *resplen2) + { + HEADER *hp = (HEADER *) answer; ++ HEADER *hp2; + int n, use_malloc = 0; + u_int oflags = statp->_flags; + +@@ -239,26 +240,25 @@ __libc_res_nquery(res_state statp, + /* __libc_res_nsend might have reallocated the buffer. */ + hp = (HEADER *) *answerp; + +- /* We simplify the following tests by assigning HP to HP2. It +- is easy to verify that this is the same as ignoring all +- tests of HP2. */ +- HEADER *hp2 = answerp2 ? (HEADER *) *answerp2 : hp; +- +- if (n < (int) sizeof (HEADER) && answerp2 != NULL +- && *resplen2 > (int) sizeof (HEADER)) ++ /* We simplify the following tests by assigning HP to HP2 or ++ vice versa. It is easy to verify that this is the same as ++ ignoring all tests of HP or HP2. */ ++ if (answerp2 == NULL || *resplen2 < (int) sizeof (HEADER)) + { +- /* Special case of partial answer. */ +- assert (hp != hp2); +- hp = hp2; ++ hp2 = hp; + } +- else if (answerp2 != NULL && *resplen2 < (int) sizeof (HEADER) +- && n > (int) sizeof (HEADER)) ++ else + { +- /* Special case of partial answer. */ +- assert (hp != hp2); +- hp2 = hp; ++ hp2 = (HEADER *) *answerp2; ++ if (n < (int) sizeof (HEADER)) ++ { ++ hp = hp2; ++ } + } + ++ /* Make sure both hp and hp2 are defined */ ++ assert((hp != NULL) && (hp2 != NULL)); ++ + if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0) + && (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) { + #ifdef DEBUG diff --git a/glibc.changes b/glibc.changes index 1b68c9c..a8a66ed 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Sep 16 11:20:29 UTC 2011 - mmarek@suse.cz + +- Fix assertion error in res_query.c, triggered by Firefox + (bso#13013). + ------------------------------------------------------------------- Wed Sep 7 07:17:16 UTC 2011 - aj@suse.de diff --git a/glibc.spec b/glibc.spec index 73dd7ae..17cb7bd 100644 --- a/glibc.spec +++ b/glibc.spec @@ -206,6 +206,8 @@ Patch70: glibc-2.15-vsyscall.patch Patch71: x86-cpuid-level2.patch # PATCH-FIX-UPSTREAM Avoid use of vsyscall aj@suse.de Patch72: glibc-2.15-avoid-vsyscall.patch +# PATCH-FIX-UPSTREAM Fix assertion error in res_query.c (bso#13013) +Patch73: glibc-resolv-assert.diff # PATCH-FEATURE-OPENSUSE -- add sha support to crypt_blowfish lnussel@suse.de Patch80: crypt_blowfish-1.2-sha.diff # PATCH-FEATURE-OPENSUSE -- use separate symbol version for Owl extensions - lnussel@suse.de @@ -323,7 +325,6 @@ library. %package devel-static - Summary: C library static libraries for -static linking Group: Development/Libraries/C and C++ Requires: %{name}-devel = %{version} @@ -444,6 +445,7 @@ rm nscd/s-stamp %patch70 -p1 %patch71 -p1 %patch72 -p1 +%patch73 -p1 # # Inconsistency detected by ld.so: dl-close.c: 719: _dl_close: Assertion `map->l_init_called' failed!