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

Unified Diff: Source/core/editing/CompositeEditCommand.cpp

Issue 71163005: Prevent recursive call of Document::execCommand() to protect from attack code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-11-13T18:35:41 Created 7 years, 1 month 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 | « LayoutTests/editing/execCommand/apply-style-iframe-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/CompositeEditCommand.cpp
diff --git a/Source/core/editing/CompositeEditCommand.cpp b/Source/core/editing/CompositeEditCommand.cpp
index 98e8af33e8ad90cf68acbd0ff955a0b0ce0bb379..30a20dfbc338dd4e0e79f672c7b5e0df419c9fdc 100644
--- a/Source/core/editing/CompositeEditCommand.cpp
+++ b/Source/core/editing/CompositeEditCommand.cpp
@@ -156,8 +156,13 @@ CompositeEditCommand::~CompositeEditCommand()
ASSERT(isTopLevelCommand() || !m_composition);
}
+static int applyNestingCounter;
+
void CompositeEditCommand::apply()
{
+ if (applyNestingCounter)
+ return;
+
if (!endingSelection().isContentRichlyEditable()) {
switch (editingAction()) {
case EditActionTyping:
@@ -183,7 +188,9 @@ void CompositeEditCommand::apply()
ASSERT(frame);
{
EventQueueScope scope;
+ ++applyNestingCounter;
leviw_travelin_and_unemployed 2013/11/13 21:16:18 I like the idea... Can we make this RAII instead?
doApply();
+ --applyNestingCounter;
}
// Only need to call appliedEditing for top-level commands,
« no previous file with comments | « LayoutTests/editing/execCommand/apply-style-iframe-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698