Index: common/str.cpp
===================================================================
--- common/str.cpp	(revision 44519)
+++ common/str.cpp	(working copy)
@@ -447,7 +447,18 @@
 	int len = vsnprintf(output._str, _builtinCapacity, fmt, va);
 	va_end(va);
 
-	if (len < (int)_builtinCapacity) {
+	if (len == -1) {
+		// MSVC doesn't return the size the full string would take up.
+		// Try increasing the size of the string until it fits.
+		int size = _builtinCapacity;
+		do {
+			size *= 2;
+			output.ensureCapacity(size-1, false);
+			va_start(va, fmt);
+			len = vsnprintf(output._str, size, fmt, va);
+			va_end(va);
+		} while (len == -1 || len >= size);
+	} else if (len < (int)_builtinCapacity) {
 		// vsnprintf succeeded
 		output._size = len;
 	} else {
