From 7d85da882b177e4be251a44f356d62ed5f7c2de0 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 14 Feb 2016 21:05:29 +0500 Subject: [PATCH] Cycles: Fix infinite recursion of md5 calculation on Windows Was caused by some safety things of making sure we've for NULL terminator for the buffer when doing mbs<->wcs conversion, but it turns out this simply confuses str::string and it can no longer have proper .size(). Let's assume behavior of string allocation is same all over the std, and we can avoid having that extra null-terminator allocated. --- intern/cycles/util/util_string.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/intern/cycles/util/util_string.cpp b/intern/cycles/util/util_string.cpp index d2c1ebe4151..51306a249cd 100644 --- a/intern/cycles/util/util_string.cpp +++ b/intern/cycles/util/util_string.cpp @@ -171,7 +171,7 @@ wstring string_to_wstring(const string& str) str.length(), NULL, 0); - wstring str_wc(length_wc + 1, 0); + wstring str_wc(length_wc, 0); MultiByteToWideChar(CP_ACP, 0, str.c_str(), @@ -190,7 +190,7 @@ string string_from_wstring(const wstring& str) NULL, 0, NULL, NULL); - string str_mb(length_mb + 1, 0); + string str_mb(length_mb, 0); WideCharToMultiByte(CP_ACP, 0, str.c_str(),