summaryrefslogtreecommitdiffstats
path: root/WebCore/dom
diff options
context:
space:
mode:
authorBart Sears <bsears@google.com>2011-03-13 17:32:54 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-03-13 17:32:54 -0700
commitdf04d7a71c88ac5b84b3a3d06fdc8834eb1f2da2 (patch)
tree71dbafed5c17ca7e9eb95d68a058d3dd20616625 /WebCore/dom
parent25b379124e2660c9310c65e647c32d533d9237c0 (diff)
parentbcc077531734eca7eb8663a76ab8d4c15721672c (diff)
downloadexternal_webkit-df04d7a71c88ac5b84b3a3d06fdc8834eb1f2da2.zip
external_webkit-df04d7a71c88ac5b84b3a3d06fdc8834eb1f2da2.tar.gz
external_webkit-df04d7a71c88ac5b84b3a3d06fdc8834eb1f2da2.tar.bz2
am bcc07753: Cherry-pick change Ibaa52a6b (webkit security patch)
* commit 'bcc077531734eca7eb8663a76ab8d4c15721672c': Cherry-pick change Ibaa52a6b (webkit security patch)
Diffstat (limited to 'WebCore/dom')
-rw-r--r--WebCore/dom/StyleElement.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/WebCore/dom/StyleElement.cpp b/WebCore/dom/StyleElement.cpp
index 157e8f9..e9878a6 100644
--- a/WebCore/dom/StyleElement.cpp
+++ b/WebCore/dom/StyleElement.cpp
@@ -95,8 +95,12 @@ void StyleElement::process(Element* e)
unsigned resultLength = 0;
for (Node* c = e->firstChild(); c; c = c->nextSibling()) {
Node::NodeType nodeType = c->nodeType();
- if (nodeType == Node::TEXT_NODE || nodeType == Node::CDATA_SECTION_NODE || nodeType == Node::COMMENT_NODE)
- resultLength += c->nodeValue().length();
+ if (nodeType == Node::TEXT_NODE || nodeType == Node::CDATA_SECTION_NODE || nodeType == Node::COMMENT_NODE) {
+ unsigned length = c->nodeValue().length();
+ if (length > std::numeric_limits<unsigned>::max() - resultLength)
+ CRASH();
+ resultLength += length;
+ }
}
UChar* text;
String sheetText = String::createUninitialized(resultLength, text);