X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3625820490496633a180ee57035f11b86c181798..96c9640205933ad0673d5af2c96af0816c50160c:/src/html/htmlpars.cpp diff --git a/src/html/htmlpars.cpp b/src/html/htmlpars.cpp index ed99a443b6..dad3f09a42 100644 --- a/src/html/htmlpars.cpp +++ b/src/html/htmlpars.cpp @@ -957,12 +957,14 @@ wxHtmlParser::SkipCommentTag(wxString::const_iterator& start, wxString::const_iterator p = start; - // comments begin with "<!--" in HTML 4.0 - if ( end - start < 4 || *++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