Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Unified Diff: Source/WebCore/css/CSSParser.cpp

Issue 9615047: Merge 107999 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/css/CSSParser.cpp
===================================================================
--- Source/WebCore/css/CSSParser.cpp (revision 109988)
+++ Source/WebCore/css/CSSParser.cpp (working copy)
@@ -9276,6 +9276,11 @@
// We use single quotes for now because markup.cpp uses double quotes.
String quoteCSSString(const String& string)
{
+ // This function expands each character to at most 3 characters ('\u0010' -> '\' '1' '0') as well as adds
+ // 2 quote characters (before and after). Make sure the resulting size (3 * length + 2) will not overflow unsigned.
+ if (string.length() >= (std::numeric_limits<unsigned>::max() / 3) - 2)
+ return "";
+
// For efficiency, we first pre-calculate the length of the quoted string, then we build the actual one.
// Please see below for the actual logic.
unsigned quotedStringSize = 2; // Two quotes surrounding the entire string.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698