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))Received on Wed Aug 25 2004 - 17:02:38 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:08 UTC