Hello.

i've been trying to 'make verify' libevent-1.2 on x86-64 SLES9 (gcc 3.3.3, glibc
2.3.5 (20050720) ) system.

it just segfaults on regress evbuffer test, i've tracked the issue down to
the loop calling vsnprintf() inside evbuffer_add_vprintf()

the problem is that you can't call vsnprintf() many times with the same va_list
it just segfaults on the second call, the glibc documentation states the
following:

http://www.gnu.org/software/libc/manual/html_node/Variable-Arguments-Output.html#Variable-Arguments-Output
In some other systems, the va_list pointer may become invalid after the call to 
vprintf,
 so you must not use va_arg after you call vprintf. Instead, you should call 
va_end
 to retire the pointer from service. However, you can safely call va_start on 
another
 pointer variable and begin fetching the arguments again through that pointer.
 Calling vprintf does not destroy the argument list of your function,
 merely the particular pointer that you passed to it.

i suggest using va_copy()-ing ap every time you enter the loop.
proposed patch is attached, successfuly tested on x86, x86-64 SLES9.

-- 
Anton Povarov [ [EMAIL PROTECTED] ] [ ICQ: 85431470 ]

Attachment: vprintf_va_args.patch
Description: Binary data

_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users

Reply via email to