Title: [152927] trunk/Source/WebCore
- Revision
- 152927
- Author
- [email protected]
- Date
- 2013-07-19 14:40:31 -0700 (Fri, 19 Jul 2013)
Log Message
[Windows] Avoid passing addresses of temporaries to Windows API.
https://bugs.webkit.org/show_bug.cgi?id=118917
Reviewed by Anders Carlsson.
The temporary Vector returned by String::charactersWithNullTermination
was going out of scope before its first use, causing Windows API to
receive garbage memory.
* platform/win/ContextMenuWin.cpp:
(WebCore::ContextMenu::createPlatformContextMenuFromItems):
* platform/win/PasteboardWin.cpp:
(WebCore::createGlobalHDropContent):
* platform/win/SSLKeyGeneratorWin.cpp:
(WebCore::WebCore::signedPublicKeyAndChallengeString):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (152926 => 152927)
--- trunk/Source/WebCore/ChangeLog 2013-07-19 20:54:50 UTC (rev 152926)
+++ trunk/Source/WebCore/ChangeLog 2013-07-19 21:40:31 UTC (rev 152927)
@@ -1,3 +1,21 @@
+2013-07-19 Brent Fulgham <[email protected]>
+
+ [Windows] Avoid passing addresses of temporaries to Windows API.
+ https://bugs.webkit.org/show_bug.cgi?id=118917
+
+ Reviewed by Anders Carlsson.
+
+ The temporary Vector returned by String::charactersWithNullTermination
+ was going out of scope before its first use, causing Windows API to
+ receive garbage memory.
+
+ * platform/win/ContextMenuWin.cpp:
+ (WebCore::ContextMenu::createPlatformContextMenuFromItems):
+ * platform/win/PasteboardWin.cpp:
+ (WebCore::createGlobalHDropContent):
+ * platform/win/SSLKeyGeneratorWin.cpp:
+ (WebCore::WebCore::signedPublicKeyAndChallengeString):
+
2013-07-19 Zoltan Horvath <[email protected]>
[CSS Shapes] Remove lineWithinShapeBounds() from ShapeInfo since it's no longer used
Modified: trunk/Source/WebCore/platform/win/ContextMenuWin.cpp (152926 => 152927)
--- trunk/Source/WebCore/platform/win/ContextMenuWin.cpp 2013-07-19 20:54:50 UTC (rev 152926)
+++ trunk/Source/WebCore/platform/win/ContextMenuWin.cpp 2013-07-19 21:40:31 UTC (rev 152927)
@@ -119,11 +119,14 @@
#else
// ContextMenuItem::platformContextMenuItem doesn't set the title of the MENUITEMINFO to make the
// lifetime handling easier for callers.
- String itemTitle = item.title();
+ Vector<UChar> wideCharTitle; // Retain buffer for long enough to make the InsertMenuItem call
+
+ const String& itemTitle = item.title();
if (item.type() != SeparatorType) {
menuItem.fMask |= MIIM_STRING;
menuItem.cch = itemTitle.length();
- menuItem.dwTypeData = const_cast<LPWSTR>(itemTitle.charactersWithNullTermination().data());
+ wideCharTitle = itemTitle.charactersWithNullTermination();
+ menuItem.dwTypeData = const_cast<LPWSTR>(wideCharTitle.data());
}
::InsertMenuItem(menu, i, TRUE, &menuItem);
Modified: trunk/Source/WebCore/platform/win/PasteboardWin.cpp (152926 => 152927)
--- trunk/Source/WebCore/platform/win/PasteboardWin.cpp 2013-07-19 20:54:50 UTC (rev 152926)
+++ trunk/Source/WebCore/platform/win/PasteboardWin.cpp 2013-07-19 21:40:31 UTC (rev 152927)
@@ -963,7 +963,8 @@
// windows does not enjoy a leading slash on paths
if (localPath[0] == '/')
localPath = localPath.substring(1);
- LPCWSTR localPathStr = localPath.charactersWithNullTermination().data();
+ const Vector<UChar>& localPathWide = localPath.charactersWithNullTermination();
+ LPCWSTR localPathStr = localPathWide.data();
if (wcslen(localPathStr) + 1 < MAX_PATH)
wcscpy_s(filePath, MAX_PATH, localPathStr);
else
Modified: trunk/Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp (152926 => 152927)
--- trunk/Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp 2013-07-19 20:54:50 UTC (rev 152926)
+++ trunk/Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp 2013-07-19 21:40:31 UTC (rev 152927)
@@ -68,7 +68,8 @@
String localChallenge = challenge;
// Windows API won't write to our buffer, although it's not declared with const.
- requestInfo.pwszChallengeString = const_cast<wchar_t*>(localChallenge.charactersWithNullTermination().data());
+ const Vector<UChar>& localChallengeWide = localChallenge.charactersWithNullTermination();
+ requestInfo.pwszChallengeString = const_cast<wchar_t*>(localChallengeWide.data());
CRYPT_ALGORITHM_IDENTIFIER signAlgo = { 0 };
signAlgo.pszObjId = szOID_RSA_SHA1RSA;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes