Title: [149531] trunk/Source/WebCore
Revision
149531
Author
[email protected]
Date
2013-05-03 13:29:53 -0700 (Fri, 03 May 2013)

Log Message

        REGRESSION (r145042): Downloading a file sometimes results in could not create
        a sandbox extension Console message and file stays as a .download file
        https://bugs.webkit.org/show_bug.cgi?id=115559
        <rdar://problem/13785101>

        Reviewed by Sam Weinig.

        CString is evil, it has two lengths which can be different - specifically, fileSystemRepresentation()
        creates a string with maximum possible buffer size. This was confusing resolveSymlinksInPath().

        * platform/cf/FileSystemCF.cpp: (WebCore::fileSystemRepresentation):
        Change fileSystemRepresentation to be less surprising. Really, we should rip apart
        CString and update callers to use better defined semantics, but this is the one function
        that repeatedly causes problems in practice.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149530 => 149531)


--- trunk/Source/WebCore/ChangeLog	2013-05-03 20:27:39 UTC (rev 149530)
+++ trunk/Source/WebCore/ChangeLog	2013-05-03 20:29:53 UTC (rev 149531)
@@ -1,3 +1,20 @@
+2013-05-03  Alexey Proskuryakov  <[email protected]>
+
+        REGRESSION (r145042): Downloading a file sometimes results in could not create
+        a sandbox extension Console message and file stays as a .download file
+        https://bugs.webkit.org/show_bug.cgi?id=115559
+        <rdar://problem/13785101>
+
+        Reviewed by Sam Weinig.
+
+        CString is evil, it has two lengths which can be different - specifically, fileSystemRepresentation()
+        creates a string with maximum possible buffer size. This was confusing resolveSymlinksInPath().
+
+        * platform/cf/FileSystemCF.cpp: (WebCore::fileSystemRepresentation):
+        Change fileSystemRepresentation to be less surprising. Really, we should rip apart
+        CString and update callers to use better defined semantics, but this is the one function
+        that repeatedly causes problems in practice.
+
 2013-05-03  Andreas Kling  <[email protected]>
 
         CSSRule style declarations getters shouldn't be const.

Modified: trunk/Source/WebCore/platform/cf/FileSystemCF.cpp (149530 => 149531)


--- trunk/Source/WebCore/platform/cf/FileSystemCF.cpp	2013-05-03 20:27:39 UTC (rev 149530)
+++ trunk/Source/WebCore/platform/cf/FileSystemCF.cpp	2013-05-03 20:29:53 UTC (rev 149531)
@@ -44,15 +44,14 @@
 
     CFIndex size = CFStringGetMaximumSizeOfFileSystemRepresentation(cfString.get());
 
-    char* buffer;
-    CString string = CString::newUninitialized(size, buffer);
+    Vector<char> buffer(size);
 
-    if (!CFStringGetFileSystemRepresentation(cfString.get(), buffer, size)) {
+    if (!CFStringGetFileSystemRepresentation(cfString.get(), buffer.data(), buffer.size())) {
         LOG_ERROR("Failed to get filesystem representation to create CString from cfString");
         return CString();
     }
 
-    return string;
+    return CString(buffer.data(), strlen(buffer.data()));
 }
 
 RetainPtr<CFURLRef> pathAsURL(const String& path)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to