Fix for 3966349, hang loading page. Make sure that loops using popOneBlock properly...
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jan 2005 21:45:20 +0000 (21:45 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jan 2005 21:45:20 +0000 (21:45 +0000)
blockStack to avoid an infinite loop.

        Reviewed by kocienda

        * khtml/html/htmlparser.cpp:
        (KHTMLParser::parseToken):
        (KHTMLParser::insertNode):
        (KHTMLParser::popInlineBlocks):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8427 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/html/htmlparser.cpp

index d23c5f5b8275b37dd196a2fb7b71746a3ad2f075..eadc4087e80beab8ed78426aa7e72ea780859d86 100644 (file)
@@ -1,3 +1,15 @@
+2005-01-21  David Hyatt  <hyatt@apple.com>
+
+       Fix for 3966349, hang loading page.  Make sure that loops using popOneBlock properly check for a null
+       blockStack to avoid an infinite loop.
+       
+        Reviewed by kocienda
+
+        * khtml/html/htmlparser.cpp:
+        (KHTMLParser::parseToken):
+        (KHTMLParser::insertNode):
+        (KHTMLParser::popInlineBlocks):
+
 2005-01-21  Ken Kocienda  <kocienda@apple.com>
 
         Reviewed by John
index 37ad47793ca37579c09d0a432194b029f234ba6d..99196e5932342b67560e6c86ec17aa8feb19766e 100644 (file)
@@ -257,7 +257,7 @@ void KHTMLParser::parseToken(Token *t)
 
     // if this tag is forbidden inside the current context, pop
     // blocks until we are allowed to add it...
-    while (t->id <= ID_LAST_TAG && forbiddenTag[t->id]) {
+    while (blockStack && t->id <= ID_LAST_TAG && forbiddenTag[t->id]) {
 #ifdef PARSER_DEBUG
         kdDebug( 6035 ) << "t->id: " << t->id << " is forbidden :-( " << endl;
 #endif
@@ -359,7 +359,7 @@ bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
         case ID_TD:
             if (inStrayTableContent && !isTableRelatedTag(current->id())) {
                 // pop out to the nearest enclosing table-related tag.
-                while (!isTableRelatedTag(current->id()))
+                while (blockStack && !isTableRelatedTag(current->id()))
                     popOneBlock();
                 return insertNode(n);
             }
@@ -539,7 +539,7 @@ bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
         case ID_TFOOT:
         case ID_COLGROUP: {
             if (isTableRelatedTag(current->id())) {
-                while (current->id() != ID_TABLE && isTableRelatedTag(current->id()))
+                while (blockStack && current->id() != ID_TABLE && isTableRelatedTag(current->id()))
                     popOneBlock();
                 return insertNode(n);
             }
@@ -1436,7 +1436,7 @@ void KHTMLParser::popOneBlock(bool delBlock)
 
 void KHTMLParser::popInlineBlocks()
 {
-    while(current->isInline())
+    while (blockStack && current->isInline())
         popOneBlock();
 }