From owner-freebsd-current@FreeBSD.ORG Wed Aug 25 19:02:38 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 037A816A50D; Wed, 25 Aug 2004 19:02:38 +0000 (GMT) Received: from mail.mcneil.com (rrcs-west-24-199-45-54.biz.rr.com [24.199.45.54]) by mx1.FreeBSD.org (Postfix) with ESMTP id AD4B943D2D; Wed, 25 Aug 2004 19:02:37 +0000 (GMT) (envelope-from sean@mcneil.com) Received: from localhost (localhost.mcneil.com [127.0.0.1]) by mail.mcneil.com (Postfix) with ESMTP id 2E502FD0CC; Wed, 25 Aug 2004 12:02:37 -0700 (PDT) Received: from mail.mcneil.com ([127.0.0.1]) by localhost (server.mcneil.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03625-09; Wed, 25 Aug 2004 12:02:36 -0700 (PDT) Received: from [24.199.45.54] (mcneil.com [24.199.45.54]) by mail.mcneil.com (Postfix) with ESMTP id 5C12CFD03D; Wed, 25 Aug 2004 12:02:36 -0700 (PDT) From: Sean McNeil To: obrien@freebsd.org In-Reply-To: <20040825181730.GJ53710@dragon.nuxi.com> References: <1092777586.92327.9.camel@server.mcneil.com> <1093369220.10362.6.camel@server.mcneil.com> <20040824200225.V517@beagle.kn.op.dlr.de> <1093371600.10464.23.camel@server.mcneil.com> <20040824205417.L517@beagle.kn.op.dlr.de> <1093377802.43728.11.camel@server.mcneil.com> <1093385848.84723.2.camel@server.mcneil.com> <20040825181730.GJ53710@dragon.nuxi.com> Content-Type: text/plain Message-Id: <1093460556.82060.5.camel@server.mcneil.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Wed, 25 Aug 2004 12:02:36 -0700 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mcneil.com cc: Giorgos Keramidas cc: Tim Kientzle cc: Harti Brandt cc: current@freebsd.org Subject: Re: bsdtar core dumps X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Aug 2004 19:02:38 -0000 On Wed, 2004-08-25 at 11:17, David O'Brien wrote: > On Tue, Aug 24, 2004 at 03:17:28PM -0700, Sean McNeil wrote: > > > > SM>> You cannot use a va_list twice. As soon as someone call > > > > va_arg() on the SM>> ap all the aps in the calling functions get > > > > invalid. The only thing that SM>> can and must be done is that the > > > > function that did the va_start() must SM>> call va_end. > ... > > I missed one in vfwprintf.c. I needs a va_end(orgap) just like above. > > > > Also, I've searched all of src and found one additional place that there > > is a va_copy without a va_end. > > > > contrib/gnu-sort/lib/version-etc.c > > > > All other uses appear to be properly matched. > > Can you please make a new, complete patch? > I'll commit it ASAP. Thanks David, Here are are the patches of all unmatched/missing va_copy/va_end and core dump fix to libarchive: *** ./contrib/gnu-sort/lib/version-etc.c.orig Wed Aug 11 23:55:32 2004 --- ./contrib/gnu-sort/lib/version-etc.c Wed Aug 25 11:56:22 2004 *************** Written by %s, %s, %s,\n%s, %s, %s, %s,\ *** 140,146 **** authors); break; } ! va_end (authors); putc ('\n', stream); fputs (version_etc_copyright, stream); --- 140,148 ---- authors); break; } ! #ifdef va_copy ! va_end (tmp_authors); ! #endif putc ('\n', stream); fputs (version_etc_copyright, stream); *************** version_etc (FILE *stream, *** 175,178 **** --- 177,181 ---- va_start (authors, version); version_etc_va (stream, command_name, package, version, authors); + va_end (authors); } *** ./lib/libarchive/archive_string_sprintf.c.orig Fri Aug 13 20:45:45 2004 --- ./lib/libarchive/archive_string_sprintf.c Wed Aug 25 11:55:46 2004 *************** __archive_string_vsprintf(struct archive *** 47,65 **** va_list ap) { size_t l; if (fmt == NULL) { as->s[0] = 0; return; } l = vsnprintf(as->s, as->buffer_length, fmt, ap); /* If output is bigger than the buffer, resize and try again. */ if (l+1 >= as->buffer_length) { __archive_string_ensure(as, l + 1); ! l = vsnprintf(as->s, as->buffer_length, fmt, ap); } as->length = l; } /* --- 47,68 ---- va_list ap) { size_t l; + va_list ap1; if (fmt == NULL) { as->s[0] = 0; return; } + va_copy(ap1,ap); l = vsnprintf(as->s, as->buffer_length, fmt, ap); /* If output is bigger than the buffer, resize and try again. */ if (l+1 >= as->buffer_length) { __archive_string_ensure(as, l + 1); ! l = vsnprintf(as->s, as->buffer_length, fmt, ap1); } as->length = l; + va_end(ap1); } /* *** ./lib/libc/stdio/vfprintf.c.orig Tue Jun 8 05:03:48 2004 --- ./lib/libc/stdio/vfprintf.c Wed Aug 25 11:55:30 2004 *************** error: *** 1237,1242 **** --- 1237,1243 ---- if (dtoaresult != NULL) freedtoa(dtoaresult); #endif + va_end(orgap); if (convbuf != NULL) free(convbuf); if (__sferror(fp)) *** ./lib/libc/stdio/vfwprintf.c.orig Tue Jun 8 05:03:48 2004 --- ./lib/libc/stdio/vfwprintf.c Wed Aug 25 11:55:30 2004 *************** number: if ((dprec = prec) >= 0) *** 1232,1237 **** --- 1232,1238 ---- } done: error: + va_end(orgap); if (convbuf != NULL) free(convbuf); if (__sferror(fp))