[Bf-blender-cvs] [7d85da8] master: Cycles: Fix infinite recursion of md5 calculation on Windows

Sergey Sharybin noreply at git.blender.org
Sun Feb 14 21:08:32 CET 2016


Commit: 7d85da882b177e4be251a44f356d62ed5f7c2de0
Author: Sergey Sharybin
Date:   Sun Feb 14 21:05:29 2016 +0500
Branches: master
https://developer.blender.org/rB7d85da882b177e4be251a44f356d62ed5f7c2de0

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.

===================================================================

M	intern/cycles/util/util_string.cpp

===================================================================

diff --git a/intern/cycles/util/util_string.cpp b/intern/cycles/util/util_string.cpp
index d2c1ebe..51306a2 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(),




More information about the Bf-blender-cvs mailing list