Title: [208765] trunk/Source/WebCore
Revision
208765
Author
[email protected]
Date
2016-11-15 16:06:57 -0800 (Tue, 15 Nov 2016)

Log Message

Ensure sufficient buffer for worst-case URL encoding
https://bugs.webkit.org/show_bug.cgi?id=164794
<rdar://problem/5905510>

Reviewed by David Kilzer.

Slightly increase the default allocation size for URL parsing to account for
the worst-case parsing case. Under these assumptions, we might need three times
the byte length of the URL, plus nine bytes for fix-up characters.

In short, increase the default buffer size by 9 bytes.

No new tests. No change in behavior.

* platform/URL.cpp:
(WebCore::URL::parse): Slightly increase the default buffer size.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (208764 => 208765)


--- trunk/Source/WebCore/ChangeLog	2016-11-15 23:48:21 UTC (rev 208764)
+++ trunk/Source/WebCore/ChangeLog	2016-11-16 00:06:57 UTC (rev 208765)
@@ -1,3 +1,22 @@
+2016-11-15  Brent Fulgham  <[email protected]>
+
+        Ensure sufficient buffer for worst-case URL encoding
+        https://bugs.webkit.org/show_bug.cgi?id=164794
+        <rdar://problem/5905510>
+
+        Reviewed by David Kilzer.
+
+        Slightly increase the default allocation size for URL parsing to account for
+        the worst-case parsing case. Under these assumptions, we might need three times
+        the byte length of the URL, plus nine bytes for fix-up characters.
+
+        In short, increase the default buffer size by 9 bytes.
+
+        No new tests. No change in behavior.
+
+        * platform/URL.cpp:
+        (WebCore::URL::parse): Slightly increase the default buffer size.
+
 2016-11-15  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: Remove unused and untested Page.setTouchEmulationEnabled command

Modified: trunk/Source/WebCore/platform/URL.cpp (208764 => 208765)


--- trunk/Source/WebCore/platform/URL.cpp	2016-11-15 23:48:21 UTC (rev 208764)
+++ trunk/Source/WebCore/platform/URL.cpp	2016-11-16 00:06:57 UTC (rev 208765)
@@ -1676,7 +1676,11 @@
 
     // assemble it all, remembering the real ranges
 
-    Vector<char, 4096> buffer(fragmentEnd * 3 + 1);
+    // The magic number 10 comes from the worst-case addition of characters for password start,
+    // user info, and colon for port number, colon after scheme, plus inserting missing slashes
+    // after protocol, slash for empty path, and possible end-of-query '#' character. This
+    // yields a max of nine additional characters, plus a null.
+    Vector<char, 4096> buffer(fragmentEnd * 3 + 10);
 
     char* p = buffer.data();
     const char* strPtr = url;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to