Bug 596180 - Limit the number of iterations in the adoption agency algorithm. rs=jonas, a=blocking2.0-betaN.
This commit is contained in:
@@ -336,6 +336,8 @@ public abstract class TreeBuilder<T> implements TokenHandler,
|
|||||||
|
|
||||||
private static final int NOT_FOUND_ON_STACK = Integer.MAX_VALUE;
|
private static final int NOT_FOUND_ON_STACK = Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
private static final int AAA_MAX_ITERATIONS = 10;
|
||||||
|
|
||||||
// [NOCPP[
|
// [NOCPP[
|
||||||
|
|
||||||
private static final @Local String HTML_LOCAL = "html";
|
private static final @Local String HTML_LOCAL = "html";
|
||||||
@@ -4334,7 +4336,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
|
|||||||
private void adoptionAgencyEndTag(@Local String name) throws SAXException {
|
private void adoptionAgencyEndTag(@Local String name) throws SAXException {
|
||||||
// If you crash around here, perhaps some stack node variable claimed to
|
// If you crash around here, perhaps some stack node variable claimed to
|
||||||
// be a weak ref isn't.
|
// be a weak ref isn't.
|
||||||
for (;;) {
|
for (int i = 0; i < AAA_MAX_ITERATIONS; ++i) {
|
||||||
int formattingEltListPos = listPtr;
|
int formattingEltListPos = listPtr;
|
||||||
while (formattingEltListPos > -1) {
|
while (formattingEltListPos > -1) {
|
||||||
StackNode<T> listNode = listOfActiveFormattingElements[formattingEltListPos]; // weak
|
StackNode<T> listNode = listOfActiveFormattingElements[formattingEltListPos]; // weak
|
||||||
@@ -4410,7 +4412,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
|
|||||||
int bookmark = formattingEltListPos;
|
int bookmark = formattingEltListPos;
|
||||||
int nodePos = furthestBlockPos;
|
int nodePos = furthestBlockPos;
|
||||||
StackNode<T> lastNode = furthestBlock; // weak ref
|
StackNode<T> lastNode = furthestBlock; // weak ref
|
||||||
for (;;) {
|
for (int j = 0; j < AAA_MAX_ITERATIONS; ++j) {
|
||||||
nodePos--;
|
nodePos--;
|
||||||
StackNode<T> node = stack[nodePos]; // weak ref
|
StackNode<T> node = stack[nodePos]; // weak ref
|
||||||
int nodeListPos = findInListOfActiveFormattingElements(node);
|
int nodeListPos = findInListOfActiveFormattingElements(node);
|
||||||
|
|||||||
@@ -3180,7 +3180,7 @@ nsHtml5TreeBuilder::removeFromListOfActiveFormattingElements(PRInt32 pos)
|
|||||||
void
|
void
|
||||||
nsHtml5TreeBuilder::adoptionAgencyEndTag(nsIAtom* name)
|
nsHtml5TreeBuilder::adoptionAgencyEndTag(nsIAtom* name)
|
||||||
{
|
{
|
||||||
for (; ; ) {
|
for (PRInt32 i = 0; i < NS_HTML5TREE_BUILDER_AAA_MAX_ITERATIONS; ++i) {
|
||||||
PRInt32 formattingEltListPos = listPtr;
|
PRInt32 formattingEltListPos = listPtr;
|
||||||
while (formattingEltListPos > -1) {
|
while (formattingEltListPos > -1) {
|
||||||
nsHtml5StackNode* listNode = listOfActiveFormattingElements[formattingEltListPos];
|
nsHtml5StackNode* listNode = listOfActiveFormattingElements[formattingEltListPos];
|
||||||
@@ -3238,7 +3238,7 @@ nsHtml5TreeBuilder::adoptionAgencyEndTag(nsIAtom* name)
|
|||||||
PRInt32 bookmark = formattingEltListPos;
|
PRInt32 bookmark = formattingEltListPos;
|
||||||
PRInt32 nodePos = furthestBlockPos;
|
PRInt32 nodePos = furthestBlockPos;
|
||||||
nsHtml5StackNode* lastNode = furthestBlock;
|
nsHtml5StackNode* lastNode = furthestBlock;
|
||||||
for (; ; ) {
|
for (PRInt32 j = 0; j < NS_HTML5TREE_BUILDER_AAA_MAX_ITERATIONS; ++j) {
|
||||||
nodePos--;
|
nodePos--;
|
||||||
nsHtml5StackNode* node = stack[nodePos];
|
nsHtml5StackNode* node = stack[nodePos];
|
||||||
PRInt32 nodeListPos = findInListOfActiveFormattingElements(node);
|
PRInt32 nodeListPos = findInListOfActiveFormattingElements(node);
|
||||||
|
|||||||
@@ -350,6 +350,7 @@ jArray<const char*,PRInt32> nsHtml5TreeBuilder::QUIRKY_PUBLIC_IDS = nsnull;
|
|||||||
#define NS_HTML5TREE_BUILDER_CHARSET_DOUBLE_QUOTED 10
|
#define NS_HTML5TREE_BUILDER_CHARSET_DOUBLE_QUOTED 10
|
||||||
#define NS_HTML5TREE_BUILDER_CHARSET_UNQUOTED 11
|
#define NS_HTML5TREE_BUILDER_CHARSET_UNQUOTED 11
|
||||||
#define NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK PR_INT32_MAX
|
#define NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK PR_INT32_MAX
|
||||||
|
#define NS_HTML5TREE_BUILDER_AAA_MAX_ITERATIONS 10
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user