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

Unified Diff: Source/WebCore/dom/StyleElement.cpp

Issue 6670019: Merge 80787 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/648/
Patch Set: Created 9 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/dom/StyleElement.cpp
===================================================================
--- Source/WebCore/dom/StyleElement.cpp (revision 80787)
+++ Source/WebCore/dom/StyleElement.cpp (working copy)
@@ -101,8 +101,12 @@
unsigned resultLength = 0;
for (Node* c = e->firstChild(); c; c = c->nextSibling()) {
- if (isValidStyleChild(c))
- resultLength += c->nodeValue().length();
+ if (isValidStyleChild(c)) {
+ unsigned length = c->nodeValue().length();
+ if (length > std::numeric_limits<unsigned>::max() - resultLength)
+ CRASH();
+ resultLength += length;
+ }
}
UChar* text;
String sheetText = String::createUninitialized(resultLength, text);
« 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