From: Vadim Zeitlin Date: Thu, 13 Jan 2011 14:49:55 +0000 (+0000) Subject: Fixes for parsing invalid HTML without tag ends. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/3625820490496633a180ee57035f11b86c181798 Fixes for parsing invalid HTML without tag ends. The code in wxHtmlParser supposed in many places that a '<' character must be always followed by a '>' one and could create (and sometimes dereference) invalid iterators if this wasn't the case resulting in asserts from MSVC debug CRT and possibly crashes. Fix this by ensuring that only valid iterators are used and add a trivial unit test for wxHtmlParser which checks that it can parse invalid HTML without crashing. Closes #12869. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66678 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/html/htmlpars.cpp b/src/html/htmlpars.cpp index 38c0680c23..ed99a443b6 100644 --- a/src/html/htmlpars.cpp +++ b/src/html/htmlpars.cpp @@ -227,7 +227,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; @@ -958,7 +958,7 @@ wxHtmlParser::SkipCommentTag(wxString::const_iterator& start, wxString::const_iterator p = start; // comments begin with "