StringUtil::vform() formats a variable argument vector into a std::string. It tries to use vsnprintf into a 1024 character buffer. If that fails because the buffer is too small, it grows the buffer and tries again. However, it was reusing the same va_list argument pointer, which points off the end of the argument list after the first go-around with vsnprintf. The second try usually crashes, or at least results in something unexpected. Fixed this by saving the va_list state using va_copy(). This is a C99 macro, so older systems might have a problem with this fix.
Log in to post a comment.