]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/htmlpars.cpp
Fix another crash when conversion fails in Unix PostScript code.
[wxWidgets.git] / src / html / htmlpars.cpp
index 38c0680c232a5eb5507c41f2d7118c9862500dba..0e38da7bc4b3d1a60bb55aec9b26b10032c1163c 100644 (file)
@@ -2,7 +2,6 @@
 // Name:        src/html/htmlpars.cpp
 // Purpose:     wxHtmlParser class (generic parser)
 // Author:      Vaclav Slavik
-// RCS-ID:      $Id$
 // Copyright:   (c) 1999 Vaclav Slavik
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -227,7 +226,7 @@ void wxHtmlParser::CreateDOMSubTree(wxHtmlTag *cur,
             else
             {
                 while (i < end_pos && *i != wxT('>')) ++i;
-                textBeginning = i+1;
+                textBeginning = i < end_pos ? i+1 : i;
             }
         }
         else ++i;
@@ -957,12 +956,14 @@ wxHtmlParser::SkipCommentTag(wxString::const_iterator& start,
 
     wxString::const_iterator p = start;
 
-    // comments begin with "<!--" in HTML 4.0
-    if ( p > end - 3 || *++p != '!' || *++p != '-' || *++p != '-' )
-    {
-        // not a comment at all
-        return false;
-    }
+    // Comments begin with "<!--" in HTML 4.0; anything shorter or not containing
+    // these characters is not a comment and we're not going to skip it.
+    if ( ++p == end || *p != '!' )
+      return false;
+    if ( ++p == end || *p != '-' )
+      return false;
+    if ( ++p == end || *p != '-' )
+      return false;
 
     // skip the start of the comment tag in any case, if we don't find the
     // closing tag we should ignore broken markup